PHP/MySQL problem - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

PHP/MySQL problem

DavidJackson4DavidJackson4 Posts: 33Member
I'm having a problem with a PHP script on my web page that is intended to insert records into a ProductInfo relation and then into a Books relation. Here is the code:

$sql = "INSERT INTO ProductInfo(PID,ProductInfo,Price,Department) VALUES ($newPID,' ', $theprice,'Books')";

$sql = "INSERT INTO Books(ISBN, Title, PID, FNAME, LNAME, Condition) VALUES ($ISBNtextbox, $titletextbox, $newPID, $fnametextbox, $lnametextbox, $Conditiontextbox)";
$result = mysql_query($sql);

For some reason, it will insert into the ProductInfo but not into the Books relation. There are no obvioius errors for the user using the webpage, but when I go check the database there is a problem.

Two questions:
1. Does anyone know what's wrong?
2. Does anyone know anyway to check which errors the the MySql is encountering? The support from my webhost says that they don't have a MySql error log.

David Morris

Comments

  • JonathanJonathan Posts: 2,914Member
    : $sql = "INSERT INTO Books(ISBN, Title, PID, FNAME, LNAME, Condition) VALUES ([red]'[/red]$ISBNtextbox[red]'[/red], [red]'[/red]$titletextbox[red]'[/red], $newPID, [red]'[/red]$fnametextbox[red]'[/red], [red]'[/red]$lnametextbox[red]'[/red], [red]'[/red]$Conditiontextbox[red]'[/red])";
    : $result = mysql_query($sql);
    :
    You need to put text literals in single quotes (see above).

    Jonathan


    ###
    for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
    (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
    /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");

  • skylarskylar Posts: 82Member
    Also make sure and echo out the mysql_errors if you are having any problems with sql.

    echo mysql_error();
    [b][blue]Snoochie Boochies[/blue][/b]

Sign In or Register to comment.