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

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

ddd789 10-08-07 14:41

בעיה בקוד
 
PHP קוד:

while ($row mysql_fetch_array($result))
{
echo 
"<td bgcolor="#808080">נושא:", $row['subject'], "מפרסם:", $row['name'], "פורסם בתאריך:", $row['date'], "</td></tr>";
echo "<tr>";
echo 
"<td bgcolor="#909090">", $row['content'], "</td></tr>";


יש לי פה בעיה
Parse error: syntax error, unexpected T_ECHO, expecting ',' or ';' in

תעזרו בקשה

Elad-A 10-08-07 14:43

תנסה ככה:

PHP קוד:

while ($row mysql_fetch_array($result)) 

echo 
"<td bgcolor=\"#808080\">נושא:"$row['subject']. "מפרסם:"$row['name']. "פורסם בתאריך:"$row['date']. "</td></tr>"
echo 
"<tr>"
echo 
"<td bgcolor=\"#909090\">"$row['content']. "</td></tr>"


אתה צריך להבריח גרשים..

ddd789 10-08-07 14:46

query failed : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'table ORDER BY id DESC' at line 1
עכשיו זה רושם לי
זה הקוד של שאיתות
$query = "SELECT * FROM table ORDER BY id DESC";
$result = mysql_query($query) or die("query failed : " . mysql_error());

Elad-A 10-08-07 14:47

הטבלה table קיימת בכלל? ויש בה ID?

ddd789 10-08-07 14:54

כן יש

Eran-s 10-08-07 14:56

תנסה לרשום `table`

ddd789 10-08-07 15:02

עובד עכשיו יש לי פה בעיה
echo "<font color='green'>התגובה נוספה בהצלחה!</font><br />";
echo "לחץ <a href="index.php">כאן </a>כדי לעבור לעמוד התגובות";
}
בעמוד של הוספה

SHeDoN 10-08-07 15:03

24 שעות יש לך כדי לשנות את הכותרת לכותרת עניינית ("בעיה בקוד" זאת התחלה טובה - אבל לא מתארת לי שום דבר).

ddd789 10-08-07 15:05

תשנה אני לא יוכל ל" בעיה בקוד בPHP במערכת שניסתי לעשות

Elad-A 10-08-07 15:06

PHP קוד:

echo "<font color='green'>התגובה נוספה בהצלחה!</font><br />";
echo 
"לחץ <a href=\"index.php\">כאן </a>כדי לעבור לעמוד התגובות";



ddd789 10-08-07 15:09

יש לי עכשיו בעיה מוזרה אחרי שאני שולח הודעה זה רושם לי


Warning: Wrong parameter count for mysql_query() in /home/**/add.php on line 17
query failed :

זה קוד שורה 17
$result = mysql_query($query) or die("query failed : " . mysql_query());

Elad-A 10-08-07 15:12

תראה את כל הקוד שלך

ddd789 10-08-07 15:13

<form method="post" action="">
שם:<input type="text" name="name" maxlength=15 /><br />
נושא:<input type="text" name="subject" maxlength=15 /><br />
תוכן ההודעה:<br /><textarea name="content" maxlength=40></textarea><br />
<input type="submit" value="הגב!" name="submit" />
</form>
<?php
$submit = $_POST['submit'];
if ($submit)
{
include("connect.php");
$name = htmlspecialchars($_POST['name']);
$subject = htmlspecialchars($_POST['subject']);
$content = htmlspecialchars($_POST['content']);
$date = date("j/n/y");
$query = "INSERT INTO table (name, subject, content, date) VALUES ('$name', '$subject', '$content', '$date')";
$result = mysql_query($query) or die("query failed : " . mysql_query());
echo "<font color='green'>התגובה נוספה בהצלחה!</font><br />";
echo "לחץ <a href=\"index.php\">כאן </a>כדי לעבור לעמוד התגובות";
}

?>
<hr />

Elad-A 10-08-07 15:25

PHP קוד:

<form method="post" action=""> 
שם:<input type="text" name="name" maxlength=15 /><br />
נושא:<input type="text" name="subject" maxlength=15 /><br />
תוכן ההודעה:<br /><textarea name="content" maxlength=40></textarea><br />
<input type="submit" value="הגב!" name="submit" />
</form>
<?php
$submit 
$_POST['submit'];
if (
$submit)
{
include(
"connect.php");
$name htmlspecialchars($_POST['name']);
$subject htmlspecialchars($_POST['subject']);
$content htmlspecialchars($_POST['content']);
$date date("j/n/y");
$query "INSERT INTO 'table' (name, subject, content, date) VALUES ('$name', '$subject', '$content', '$date')";
$result mysql_query($query) or die("query failed : " mysql_query());
echo 
"<font color='green'>התגובה נוספה בהצלחה!</font><br />"
echo 
"לחץ <a href=\"index.php\">כאן </a>כדי לעבור לעמוד התגובות"


?>
<hr />



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

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