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

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

HaMashiah 09-01-06 19:59

בעיה בלולאה PHP יש קוד והכל
 
הינה השגיאה:
קוד:

Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in /home/idanre/domains/idan.be/public_html/topsites/register.php on line 124
והינה הקוד של הלולאה
PHP קוד:

<select name='category_id'>

      
$category_query="SELECT * FROM categories ORDER BY id DESC";
 
      
$result=@mysql_query($category_query,$con);

      while (
$row=mysql_fetch_array($result))
      {
    echo 
"<option value=".$row["id"].">".$row["catname"]."</option>";
      }


</
select


DaNieLLL 09-01-06 20:03

PHP קוד:

$category_query="SELECT * FROM categories ORDER BY id DESC"

תשנה ל:

PHP קוד:

$category_query mysql_query("SELECT * FROM categories ORDER BY id DESC"); 

ו

PHP קוד:

<select name='category_id'

תשנה ל:

PHP קוד:

echo "<select name='category_id'>"

לא נראה לי שאתה יכול סתם להדביק קוד html בתוך php

גם את

PHP קוד:

</select

ל
PHP קוד:

 echo "</select>"


Eran-s 09-01-06 20:07

מה ש-Pip אמר תעשה פחות הדבר הראשון שהוא כנראה לא שם לב אליו שכן עשית mysql_query למשתנה.

HaMashiah 09-01-06 21:32

עדיין אותה בעיה הינה הקוד המלא:
PHP קוד:

<? 
include("includes/dbconnect.php");

echo 
"
<html>
<head>
<title>הרשמה לתחרות אתרים</title>
<script language='JavaScript'>
function toggle(e, u)
{
    e.disabled = u
}
</script>
</head>
<body>
<table width='735' align='center' dir='rtl' border='1' bordercolor='#ADADAD' cellspacing='0'>
<form method='POST' action='includes/register.php'>
 <tr>
  <td width='40%' align='right' dir='rtl' bgcolor='#F4F6F5'>
   &nbsp;<font size='1' color='#2E3A41' face='tahoma'>שם משתמש:</font> <font size='1' color='#919191' face='arial'>(בין 3 ל-20 תווים)</font>
  </td>
  <td width='60%' align='right' dir='rtl' bgcolor='#F4F6F5'>
   <input type='text' name='UserName' size='25' class='textstyle' maxlength='20'>
  </td>
 </tr>
 <tr>
  <td width='40%' align='right' dir='rtl' bgcolor='#F4F6F5'>
   &nbsp;<font size='1' color='#2E3A41' face='tahoma'>סיסמה:</font> <font size='1' color='#919191' face='arial'>(בין 3 ל-20 תווים)</font>
  </td>
  <td width='60%' align='right' dir='rtl' bgcolor='#F4F6F5'>
   <input type='password' name='Password' size='25' class='textstyle' maxlength='20'>
  </td>
 </tr>
 <tr>
  <td width='40%' align='right' dir='rtl' bgcolor='#F4F6F5'>
   &nbsp;<font size='1' color='#2E3A41' face='tahoma'>אימות סיסמה:</font> <font size='1' color='#919191' face='arial'>(חייבת להיות תואמת לזאת שמעל)</font>
  </td>
  <td width='60%' align='right' dir='rtl' bgcolor='#F4F6F5'>
   <input type='password' name='Password2' size='25' class='textstyle' maxlength='20'>
  </td>
 </tr>
 <tr>
  <td width='40%' align='right' dir='rtl' bgcolor='#F4F6F5'>
   &nbsp;<font size='1' color='#2E3A41' face='tahoma'>דואר אלקטרוני:</font> <font size='1' color='#919191' face='arial'>(חייבת להיות אמיתית ופעילה)</font>
  </td>
  <td width='60%' align='right' dir='rtl' bgcolor='#F4F6F5'>
   <input type='text' name='Email' size='25' class='textstyle' maxlength='255' dir='ltr'>
  </td>
 </tr>
 <tr>
  <td width='40%' align='right' dir='rtl' bgcolor='#F4F6F5'>
   &nbsp;<font size='1' color='#2E3A41' face='tahoma'>אימות דואר אלקטרוני:</font> <font size='1' color='#919191' face='arial'>(חייב להיות תואם לזה שמעל)</font>
  </td>
  <td width='60%' align='right' dir='rtl' bgcolor='#F4F6F5'>
   <input type='text' name='Email2' size='25' class='textstyle' maxlength='255' dir='ltr'>
  </td>
 </tr>
 <tr>
  <td width='40%' align='right' dir='rtl' bgcolor='#F4F6F5'>
   &nbsp;<font size='1' color='#2E3A41' face='tahoma'>שם האתר:</font> <font size='1' color='#919191' face='arial'>(מקסימום 30 תווים)</font>
  </td>
  <td width='60%' align='right' dir='rtl' bgcolor='#F4F6F5'>
   <input type='text' name='SiteName' size='40' class='textstyle' maxlength='30'>
  </td>
 </tr>
 <tr>
  <td width='40%' align='right' dir='rtl' bgcolor='#F4F6F5'>
   &nbsp;<font size='1' color='#2E3A41' face='tahoma'>תיאור קצר לאתר:</font> <font size='1' color='#919191' face='arial'>(מקסימום 255 תווים)</font>
  </td>
  <td width='60%' align='right' dir='rtl' bgcolor='#F4F6F5'>
   <input type='text' name='SiteDesc' size='40' class='textstyle' maxlength='255'>
  </td>
 </tr>
 <tr>
  <td width='40%' align='right' dir='rtl' bgcolor='#F4F6F5'>
   &nbsp;<font size='1' color='#2E3A41' face='tahoma'>הכתובת המלאה של האתר:</font>
  </td>
  <td width='60%' align='right' dir='rtl' bgcolor='#F4F6F5'>
   <input type='text' name='SiteUrl' size='40' class='textstyle' value='http://' dir='ltr'>
  </td>
 </tr>
 <tr>
  <td width='40%' align='right' dir='rtl' bgcolor='#F4F6F5'>
   &nbsp;<font size='1' color='#2E3A41' face='tahoma'>האם יש לך באנר?</font>
  </td>
  <td width='60%' align='right' dir='rtl' bgcolor='#F4F6F5'>
   <input type='radio' name='U_NoBanner' value='Y' onclick='toggle(document.all.HideShow[0], false); toggle(document.all.HideShow[1], false); toggle(document.all.HideShow[2], false);' checked> <font size='1' color='#243947' face='tahoma'>כן</font>
   &nbsp;<input type='radio' name='U_NoBanner' value='N' onclick='toggle(document.all.HideShow[0], true); toggle(document.all.HideShow[1], true); toggle(document.all.HideShow[2], true);'> <font size='1' color='#243947' face='tahoma'>לא</font>
  </td>
 </tr>
 <tr>
  <td width='40%' align='right' dir='rtl' bgcolor='#F4F6F5'>
   &nbsp;<font size='1' color='#2E3A41' face='tahoma'>הכתובת המלאה של הבאנר של האתר:</font>
  </td>
  <td width='60%' align='right' dir='rtl' bgcolor='#F4F6F5'>
   <input type='text' name='U_SiteBLink' size='40' class='textstyle' value='http://' dir='ltr' id='HideShow'>
  </td>
 </tr>
 <tr>
  <td width='40%' align='right' dir='rtl' bgcolor='#F4F6F5'>
   &nbsp;<font size='1' color='#2E3A41' face='tahoma'>רוחב הבאנר:</font> <font size='1' color='#919191' face='arial'>(בפיקסלים, מקסימום 468)</font>
  </td>
  <td width='60%' align='right' dir='rtl' bgcolor='#F4F6F5'>
   <input type='text' name='U_SiteBWidth' size='5' class='textstyle' id='HideShow'>
  </td>
 </tr>
 <tr>
  <td width='40%' align='right' dir='rtl' bgcolor='#F4F6F5'>
   &nbsp;<font size='1' color='#2E3A41' face='tahoma'>גובה הבאנר:</font> <font size='1' color='#919191' face='arial'>(בפיקסלים, מקסימום 60)</font>
  </td>
  <td width='60%' align='right' dir='rtl' bgcolor='#F4F6F5'>
   <input type='text' name='U_SiteBHeight' size='5' class='textstyle' id='HideShow'>
  </td>
 </tr>

 <tr>
  <td width='40%' align='right' dir='rtl' bgcolor='#F4F6F5'>
   &nbsp;<font size='1' color='#2E3A41' face='tahoma'>קטגוריית האתר:</font>
  </td>
  <td width='60%' align='right' dir='rtl' bgcolor='#F4F6F5'>
<select name='category_id'>

      $category_query = mysql_query("
SELECT FROM categories ORDER BY id DESC"); 
 
      $result=@mysql_query($category_query,$con);

      while ($row=mysql_fetch_array($result))
      {
    echo "
<option value=".$row["id"].">".$row["catname"]."</option>";
      }


</select>
  </td>
 </tr>
</table>
</form>
</body>
</html>
"
;

include(
"includes/dbclose.php");
?>


Eran-s 09-01-06 23:27

הכנסת את הלולאה לתוך ההדפסה וזה אסור.
סוגרים אותו ( "; ) ולאחר מכן מדפיסים שוב.


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

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