||10-24-2007 01:04 AM
Need Help Mysql Query
Here is what I have
$query = sprintf( "insert into images set realname='%s',
user='%s', size='%s', used='%s',
type='%s', desc='%s', ip='%s',
private='1', report='0'", $filename_orig, $username, $filesize, $date, $filetype, $desc, $_SERVER['REMOTE_ADDR']);
I am getting as an error T_LNUMBER where the private and report entries are.
||10-24-2007 01:21 AM
This is all I use to insert something into a table. It seems to work for me. I don't know if you can use the sprintf function with this method, as I'm not to familiar with sprintf.
$query = "INSERT INTO images (field, field, field) VALUES ('$variable', '$variable', '$variable')";
$result = mysql_query($query);
Of course you can do that in one variable, but I like having them separate.
||10-24-2007 01:24 AM
I've reshuffled your query and everything appears to be working fine. I don't know where the error was coming from. Incidentally, if you're new to PHP then you may wish to read this article
. It will help you get a better understanding of what types of variables you are dealing with.
$query = sprintf(" INSERT INTO
realname = '%s',
user = '%s',
size = %d,
used = '%s',
type = '%s',
desc = '%s',
ip = '%s',
private = %d,
report = %d",
||10-24-2007 01:25 AM
Gurnk, you may wish to read this article
whilst I'm here referring people elsewhere :) !
|All times are GMT. The time now is 11:53 PM.
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0