CariDotMy

 Forgot password?
 Register

ADVERTISEMENT

12
Return to list New
Author: lin_okinawa

macam mane nk buat forum using php

[Copy link]
Post time 16-8-2007 09:39 AM | Show all posts
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..
Reply

Use magic Report


ADVERTISEMENT


Post time 3-9-2007 11:35 AM | Show all posts
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
Reply

Use magic Report

Post time 5-9-2007 12:19 PM | Show all posts
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...
Reply

Use magic Report

Post time 5-9-2007 12:28 PM | Show all posts
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

Use magic Report

Post time 5-9-2007 12:30 PM | Show all posts

Reply #22 jpl_fan's post

jgn lupa tempek SQL statement tu

sebab your error lies in the SQL statement.
Reply

Use magic Report

Post time 14-9-2007 02:49 PM | Show all posts
PENIN...
camno nak belajar \ ni...
Reply

Use magic Report

Follow Us
Post time 10-10-2007 09:30 AM | Show all posts
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?
Reply

Use magic Report

Post time 10-10-2007 05:51 PM | Show all posts
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
Reply

Use magic Report


ADVERTISEMENT


12
Return to list New
You have to log in before you can reply Login | Register

Points Rules

 

ADVERTISEMENT



 

ADVERTISEMENT


 


ADVERTISEMENT
Follow Us

ADVERTISEMENT


Mobile|Archiver|Mobile*default|About Us|CariDotMy

20-1-2025 03:08 PM GMT+8 , Processed in 0.062483 second(s), 23 queries , Gzip On, Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

Quick Reply To Top Return to the list