From: "James Johnson" <[EMAIL PROTECTED]>
> Can anyone see why this code isn't working
>
> $SID = $_SESSION['svUserID'];
> $AdID = $_GET['AdID'];
>
> // get the campuses assigned
> $qCampusID = "SELECT inst_id FROM ads_campuses WHERE ad_id = $AdID";
You say down below that this query only sel
Hmm, ok I took out the
$row_CampusIDList = mysql_fetch_assoc($CampusIDList);
and it works But how come?
J
-Original Message-
From: James Johnson [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 17, 2003 9:17 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Code check please
H
Andreas Skarin wrote:
>
> I've tried to get this working for over an hour
> now, and it still won't. I don't even get an error
> message to help me find the problem so I was
> hoping that someone could check my code for me.
>
> I'm fooling around with a basic form that is
> supposed to send on
, 2001 3:46 PM
To: PHP General
Subject: Re: [PHP] Code check please
I'm sorry guys, neither of the snippets work. I must have screwed something
else up
too. Is there any way I can provoke an error message from your code examples
below?
If anyone manages to find out what's wrong, please te
Andreas,
I'm not sure about code that appears to be missing like an execute query
function or checking the number of affected rows to make sure that the
insert worked, but clearly your insert code is not properly formed. The
query could also be impacted by whether the columns are defined with sp
You want mysql_error(), call it somewhere after your query.
echo mysql_error();
Regarding the query, the following should work just fine :
$sql = "INSERT INTO tablefoo (a,b,c) VALUES ('$a','$b','$c')";
Be sure to add slashes sometime to your values beforehand. Anyway,
mysql_error() is what
June 21, 2001 8:46 AM
To: PHP General
Subject: Re: [PHP] Code check please
I'm sorry guys, neither of the snippets work. I must have screwed something else up
too. Is there any way I can provoke an error message from your code examples below?
If anyone manages to find out what
> 2. Your SQL is a bit out of whack. The "SET" clause is used for
>UPDATEs, not INSERTs.
>
>Instead, try:
>
>$sql = "INSERT INTO tabell (fornamn, efternamn, email) VALUES (" .
> "'$fornamn', '$efternamn', '$email');";
MySQL actually lets you use SET for INSERTS, though.
J
I'm sorry guys, neither of the snippets work. I must have screwed something else up
too. Is there any way I can provoke an error message from your code examples below?
If anyone manages to find out what's wrong, please tell me. I'm not giving up until
I smash this bug :-)
// Andreas
> Rich Cavan
UPDATE syntax for INSERT is allowed in MySQL, so that should not be the
problem as far as you include all fields not having default value, timestamp
type or auto_increment attribute in your statement. What's the error message
if there is any?
lenar
""Rich Cavanaugh"" <[EMAIL PROTECTED]> wrote in
At 18:00 Uhr +0200 20.06.2001, Andreas Skarin wrote:
>I've tried to get this working for over an hour
>now, and it still won't. I don't even get an error
>message to help me find the problem so I was
>hoping that someone could check my code for me.
[snip]
>$sql = "INSERT INTO tabell SET" .
>
You're using UPDATE syntax for your INSERT
try:
$sql = "INSERT INTO tabell (fornamn, efternamn, email) values ('{$fornamn}',
'{$efternamn}', '{$email}')";
Rich Cavanaugh
-Original Message-
From: Andreas Skarin [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 20, 2001 12:00 PM
To: PHP G
Your code is [mostly] fine, except for two things:
1. Although you connected to your database with mysql_connect() and
mysql_select_db(), you didn't do anything with connection.
Try using mysql_query() to send a query to the db, i.e.
mysql_query($sql).
2. Your SQL is a bit out of whack.
13 matches
Mail list logo