|
yup.. aku stuju shanaz...
sblm memulakan coding yg kritikal, pastikan pkara2 yg senang dibaiki dulu cam
select table1.*, table2.date, table2.author
from table1, table2
where table1.id = table2.id
and table1.parent_topic = "something something"
kene letak nama table dulu kat depan tuh.. nnt sql tuh jadi bingung nk guna field mana satu sebab semasa from tuh guna table lebih dari satu..
selesai tuh baru check coding2 lain.. |
|
|
|
|
|
|
|
wei korang...aku buat simple forum...tp aku duk dpt error yg sama jer sejak 2 hari
Error: 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 '' at line 1<----nie error
nie query
$sql = "INSERT INTO thread (parent_topic,subject) ";
$sql .= "VALUES ( ";
$sql .= $_POST[ 'ftopicID'] . ",";
$sql .= addslashes (htmlentities ($_POST['subject']))." )";
if (!mysqli_query ($cxn, $sql))
{
echo "Error:". mysqli_error ($cxn);
can anyone help me |
|
|
|
|
|
|
|
cuba debug code tu...
$sql = "INSERT INTO thread (parent_topic,subject) ";
$sql .= "VALUES ( ";
$sql .= $_POST[ 'ftopicID'] . ",";
$sql .= addslashes (htmlentities ($_POST['subject']))." )";
pastu add line ni
echo($sql);
line-line yang lain u commentkan dulu (guna /* ... */)
pastu outputnyer paste kat sini meh kita tengok sesama... |
|
|
|
|
|
|
|
ni saya ajar satu cara untuk debug application
kita create satu function untuk display any messages or values of variables macam ni:
function debug_print($string) {
$debug_mode = true;
if ($debug_mode) {
echo("DEBUG_PRINT: " . $string);
}
}
pastu masukkan dalam satu PHP file eg: functions.php, and include the file in every PHP file that you are working with
so masa development, lets say untuk you punya coding tu, nak tau apa kandungan SQL query dalam variable $sql, tu, just add this line in your code:
debug_print($sql);
then masa production mode, bila nak disable debug_print function tu, just set a false value to your $debug_mode variable in your function:
$debug_mode = false;
that way bila encounter function debug_print tu, dia takkan output sebab value of debug_mode = false
ni very simple example aje, you boleh canggihkan lagi... just to give you an idea on how to trace variable values during development.
good luck. |
Rate
-
1
View Rating Log
-
|
|
|
|
|
|
|
Reply #22 jpl_fan's post
jgn lupa tempek SQL statement tu
sebab your error lies in the SQL statement. |
|
|
|
|
|
|
|
PENIN...
camno nak belajar \ ni... |
|
|
|
|
|
|
|
Macam mana nak manage posts ni? Tak faham sangat? Kena store posts tu kat database ke? Atau nak store macam mana tu so that bila user lain masuk tu dapat tengok posts tu? |
|
|
|
|
|
|
|
cek joomla.org tgk. byk module yg boleh diguna. drag n drop concept. aku tgk designer aku yg pakai. cepat gak dia buat assignment guna benda nih |
|
|
|
|
|
|
| |
|