Re: [PHP] Newbie Question Can't insert values into MySQL DB via PHP

2006-02-11 Thread Duggles Temple
An update to my (former) problem:

Hi,

I've taken all your advice on debuggin, netequitte and the like.

It works now and I would like to thank you all for your help in my stupidly
newbie question.

Thanks :)


[PHP] Newbie Question Can't insert values into MySQL DB via PHP

2006-02-10 Thread Duggles Temple
Hi,

I'd like to say in advance that I am sorry about the silly and very newbie
question I'm asking.

I am having a problem with a shop system. I can't add values into the MySQL
DB via a PHP statement. The values are being transferred from one page to
another (know that from the echo statement), but the SQL statement isn't
working.

The statement is as follows:

$conn = mysql_connect($DBhost,$DBuser,$DBpass) or die('Unable to connect to
database');
$t = $_GET['newdvdtitle'];
$y = $_GET['newdvdyear'];
$c = $_GET['newdvdcost'];
$p = $_GET['newdvdpurchased'];
@mysql_select_db($DBName) or die(Unable to select database $DBName);
$sqladd = INSERT INTO 'dvd' ('id', 'title', 'year','cost','purchased')
VALUES (  NULL , '$t', '$y', '$c' , '$p' );
echo $sqladd;
$result = mysql_query($sqladd);


The information is sent from another page which has the following values:


form name=add method=get action=addvalue.php

?php
echo 'tabletrtdInsert a DVD/td/tr';
echo 'trtdinput type=text name=newdvdtitle DVD name/td/tr';
echo 'trtdinput type=text name=newdvdyear DVD year/td/tr';
echo 'trtdinput type=text name=newdvdcost DVD cost/td/tr';
echo 'trtdinput type=text name=newdvdpurchased DVD date
purchased/td/tr';
echo 'trtdinput type=submit value=Insert new dvd/td/tr';
echo '/table';
?
/form


Thanks in advance,

Douglas


Re: [PHP] Newbie Question Can't insert values into MySQL DB via PHP

2006-02-10 Thread Duggles Temple
...I knew I would forget something...

The echo statement show the values that I would input from the last page.
The MySQL error would be Query was empty.


Re: [PHP] Newbie Question Can't insert values into MySQL DB via PHP

2006-02-10 Thread Duggles Temple
I WOULD tell you the exact string that the echo statement outpus, but the
SQL has chrashed and now PHP ownt interact (damn tin of worms i've opened
here). But, I know that if i send the data from the other page, it will
arrive to the addvalue.php page and be echoed successfully (do you really
think I would not send data to be processed by the addvalue.php page? now
really)...

The only problem is that the data received from the other page is not being
sent through the SQL statement at all, hence the Query was Empty error.

Well, there must be something wrong in my programming to make that
unfathomable error, and frankly, I can't see it.