הוסטס - פורום אחסון האתרים הגדול בישראל

הוסטס - פורום אחסון האתרים הגדול בישראל (https://hosts.co.il/forums/index.php)
-   פורום תיכנות (https://hosts.co.il/forums/forumdisplay.php?f=14)
-   -   הדפסה מסודרת (https://hosts.co.il/forums/showthread.php?t=56681)

4ior 19-11-07 13:39

כי אתה צריך להוציא את ה$i=1;
מהלולאה ולשים את זה לפני הלולאה.
גבר אתה צריך קצת לחשוב, אנחנו לא יכולים לעשות לך הכל.

Nils 19-11-07 13:47

ציטוט:

נכתב במקור על ידי 4ior (פרסם 580601)
כי אתה צריך להוציא את ה$i=1;
מהלולאה ולשים את זה לפני הלולאה.
גבר אתה צריך קצת לחשוב, אנחנו לא יכולים לעשות לך הכל.

בדוגמא שהוא הביא לי ההשמה הייתה בלולאה \=

והוצאתי וזה עדיין לא עובד...

mayden 19-11-07 13:56

כי אצלך זה טבלה:
PHP קוד:

<html dir="rtl">

<head>
<link rel="stylesheet" type="text/css" href="style.css">
<style>
BODY { 
background-image: url('images/maya_08.gif') ;
background-position: 50% 50%;
background-repeat: no-repeat} 
img {border: 0;}
</style>
<title>דף חדש 1</title>
</head>

<body>
<?php
 
include ("config.php");
echo <<<st
<form method="POST" action="add_item.php">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="17%" id="AutoNumber1" height="118">


st;
  
$i 0;
  
$query mysql_query("SELECT * FROM item WHERE kat='hand_bags'"); 
  while (
$row mysql_fetch_array($query))
{
echo <<<st

  <tr>
    <td width="100%" height="12" align="center">
<img border="0" src="
{$row['pic']}" width="118" height="84">
<input type="radio" value="
{$row['value']}" checked name="R1">
    </td>


st;

if(
$i ==  0)
echo 
"</tr><tr>";
$i++;

}

?>
  </tr>
</table>
<p><input type="submit" value="שלח" name="submit"><input type="reset" value="איפוס" name="B2">
</form>
</center>


Nils 19-11-07 14:03

זה שינה את הסדר של כולם:
http://84.94.230.229/~yairsh/maya/hand_bags.php

אתם חושבים שלהוציא את הטבלה? כי אם כן זה לא יהיה מסודר כמו שצריך... יעני לא ישר

עריכה:

הוספתי TD וזה עובד
רק הבעיה שזה מדפיס לאורך במקום לרוחב \= יש דרך לבטל את זה?

mayden 19-11-07 14:46

התבלבלתי, תשנה את הקוד:
PHP קוד:

  $i 0
  
$query mysql_query("SELECT * FROM item WHERE kat='hand_bags'");  
  while (
$row mysql_fetch_array($query)) 

echo <<<
st 
      
<tr>
    <
td width="100%" height="12" align="center"
<
img border="0" src="{$row['pic']}" width="118" height="84"
<
input type="radio" value="{$row['value']}" checked name="R1"
    </
td


st

לזה:

PHP קוד:

  $i 0
  
$query mysql_query("SELECT * FROM item WHERE kat='hand_bags'");  
  while (
$row mysql_fetch_array($query)) 

echo <<<
st 

    
<td width="100%" height="12" align="center"
<
img border="0" src="{$row['pic']}" width="118" height="84"
<
input type="radio" value="{$row['value']}" checked name="R1"
    </
td


st

ובקוד הזה:
HTML קוד:

echo <<<st
<form method="POST" action="add_item.php">

<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="17%" id="AutoNumber1" height="118">


st;

תעשה ככה:
HTML קוד:

echo <<<st
<form method="POST" action="add_item.php">

<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="17%" id="AutoNumber1" height="118">
<tr>

st;


Nils 19-11-07 14:57

אווץ'
חסר סגירה כנראה ואני לא הצלחתי לזהות מהי
PHP קוד:

<html dir="rtl">

<head>
<link rel="stylesheet" type="text/css" href="style.css">
<style>
BODY { 
background-image: url('images/maya_08.gif') ;
background-position: 50% 50%;
background-repeat: no-repeat} 
img {border: 0;}
</style>
<title>דף חדש 1</title>
</head>

<body>
<?php
 
include ("config.php");
echo <<<html
<form method="POST" action="add_item.php"> 
<center> 
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="17%" id="AutoNumber1" height="118"> 
<tr>

html; 
  $i = 0; 
  $query = mysql_query("SELECT * FROM item WHERE kat='hand_bags'");  
  while ($row = mysql_fetch_array($query)) 

echo <<<st 

    <td width="100%" height="12" align="center"> 
<img border="0" src="
{$row['pic']}" width="118" height="84"> 
<input type="radio" value="
{$row['value']}" checked name="R1"> 
    </td> 


st;  

if($i % 4 ==  0)
echo "</tr><tr><td><br></td>"; 
$i++;

}
?>
  </tr>
</table>
<p><input type="submit" value="שלח" name="submit"><input type="reset" value="איפוס" name="B2">
</form>
</center>
</body>
</html>

השגיאה:
קוד:

Parse error: syntax error, unexpected $end in /home/yairsh/domains/nodomainfornow.com/public_html/maya/hand_bags.php on line 51

mayden 19-11-07 15:33

PHP קוד:

<html dir="rtl"> 

<head> 
<link rel="stylesheet" type="text/css" href="style.css"> 
<style> 
BODY {  
background-image: url('images/maya_08.gif') ; 
background-position: 50% 50%; 
background-repeat: no-repeat}  
img {border: 0;} 
</style> 
<title>דף חדש 1</title> 
</head> 

<body> 
<?php 
include ("config.php"); 
?>
html 
<form method="POST" action="add_item.php">  
<center>  
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="17%" id="AutoNumber1" height="118">  
<tr> 
<?

  $i 
0;  
  
$query mysql_query("SELECT * FROM item WHERE kat='hand_bags'");   
  while (
$row mysql_fetch_array($query))  {  
?>

    <td width="100%" height="12" align="center">  
<img border="0" src="<?=$row['pic']?>" width="118" height="84">  
<input type="radio" value="<?=$row['value']?>" checked name="R1">  
    </td>  
    <?
if($i ==  0
echo 
"</tr><tr>";  

$i++; 

?>


  </tr> 
</table> 
<p><input type="submit" value="שלח" name="submit"><input type="reset" value="איפוס" name="B2"> 
</form> 
</center> 
</body> 
</html>

זה עובד..

Nils 19-11-07 15:53

אני רואה [=

תודה רבה רבה!
אני אלמד עכשיו את הקוד...


כל הזמנים הם GMT +2. הזמן כעת הוא 09:54.

מופעל באמצעות VBulletin גרסה 3.8.6
כל הזכויות שמורות ©
כל הזכויות שמורות לסולל יבוא ורשתות (1997) בע"מ