Jump to content

[SOLVED] I give up... whats wrong !


Recommended Posts

I've done these simple form submission and insertions into DB countless times

and now this one wont work and i dunno why lol ! i just give up and hope you

guys have better eyes then i do !

 

Submission Form:

 

<form action="add2queue.php" method="get">
<table width="300" border="0" cellpadding="0" cellspacing="0" align="center" style="border: 1px solid #336699; padding: 2px;">
    <tr>
        <td colspan="2" align="center"><strong><font class="a2q_txt">Get In Queue</font></strong></td>
    </tr>
    <tr>
        <td><font class="a2q_txt">Model</font></td>
        <td><input type="text" id="model" name="model" class="a2q_box_txt" /></td>
    </tr>
    <tr>
        <td><font class="a2q_txt">Description</font></td>
        <td><input type="text" id="desc" name="desc" class="a2q_box_txt" /></td>
    </tr>
    <tr>
        <td><font class="a2q_txt">Vendor Name</font></td>
        <td><input type="text" id="vendor" name="vendor" class="a2q_box_txt" /></td>
    </tr>
    <tr>
        <td><font class="a2q_txt">Status</font></td>
        <td>
            <select id="status" name="status" class="a2q_box_txt">
            <option value="Ordered">Ordered</option>
            <option value="In">In</option>
            </select>
        </td>
    </tr>
    <tr>
        <td><font class="a2q_txt">When Complete</font></td>
        <td>
            <select id="complete" name="complete" class="a2q_box_txt">
            <option value="Return">Return</option>
            <option value="Keep">Keep</option>
            <option value="Give Away">Give Away</option>
            </select>
        </td>
    </tr>
    <tr>
        <td colspan="2" align="center">
            <input type="submit" id="submit" name="submit" value="Add My Product To Photography Queue" style="border: 1px solid #000000;" class="a2q_btn" />
        </td>
    </tr>
</table>
</form>

 

PHP Portion :

<?
//add2queue.php

include('connect2db.php');

$model = $_GET['model']; echo $model . "<BR>";
$desc = $_GET['desc']; echo $desc . "<BR>";
$vendor = $_GET['vendor']; echo $vendor . "<BR>";
$status = $_GET['status']; echo $status . "<BR>";
$complete = $_GET['complete']; echo $complete . "<BR>";

$addquery = 
		"
		INSERT INTO photoqueue (model, desc, vendor, status, complete, pm, timestamp, date) 
		VALUES ('$model', '$desc', '$vendor', '$status', '$complete', '$_COOKIE[fname]', CURRENT_TIMESTAMP(), now())
		";

echo $addquery . "<BR><BR>";

$doit = mysql_query($addquery) or die(mysql_error());

?>

 

The Bloody Error Msg :

 

 

987654

Testing Add Form

Blah Blah

Ordered

Keep

 

INSERT INTO photoqueue (model, desc, vendor, status, complete, pm, timestamp, date) VALUES ('987654', 'Testing Add Form', 'Blah Blah', 'Ordered', 'Keep', 'Piotr Turula', CURRENT_TIMESTAMP(), now())

 

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 'desc, vendor, status, complete, pm, timestamp, date) VALUES ('987654', 'Tes' at line 1

Link to comment
https://forums.phpfreaks.com/topic/70029-solved-i-give-up-whats-wrong/
Share on other sites

Hey Orio,

 

I just tried inserting a numeric value into an INT field with quotes around it, and it worked fine.  I really think it's the DESC field name.  Unless you put ` around the field name, it would throw this error...

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.