Re: [PHP] Empty Query

2003-02-25 Thread 1LT John W. Holmes
>From what I can tell, if $img is an empty string, and $file_dir is not a
directory, $sql will not be assigned a value. This could be what's causing
your error when you try to run an empty query.

---John Holmes...

- Original Message -
From: "Richard Whitney" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 25, 2003 3:25 PM
Subject: [PHP] Empty Query


> ### I have this:
> ###
> ### [serial]
> ### [model]
> ### [yr_blt]
> ### [km]
> ### [price]
> ### [hours]
> ### [details]
> ### [location]
> ### double[style]
>
> All of the 1 are the variables being passed, the word is hardcoded for
clarity
>
>
> What I get half the time:   Couldn't insert dataQuery was empty
> ###
> ### The variables are obviously being passed
> ###
> ### Here's my insert query:
> ###
> ### if($img == ""){$sql = "INSERT INTO vehicles ( `id` ,`serial`,
`model` ,
> ### `yr_blt` , `km` , `price` , `hours` , `details` , `location` , `img`,
> ### `tstamp`,
> ### `style`)
> ### VALUES ('', '$serial',
> '$model', '$yr_blt', '$km', '$price',
> ### '$hours',
> ### '$details', '$location', '0', '$tstamp', '$style');";
> ### }
> ### else
> ### {
> ###
> ###
>
$file_dir="/services/webpages/o/f/offroad-imports.com/public/uploads/mogs/$s
erial";
> ### if (!is_dir($file_dir)){
> ### umask(000);
> ### mkdir($file_dir,0777);
> ### }
> ### else{
> ### umask(000);
> ###
> ### $path = $file_dir . "/1.jpg";
> ### move_uploaded_file($img, $path)or die('Could not upload
photo');
> ### $sql = "INSERT INTO vehicles ( `id` ,`serial`,  `model` ,
`yr_blt` ,
> `km`
> ### ,
> ### `price` , `hours` , `details` , `location` , `img`, `tstamp`, `style`)
> ### VALUES ('', '$serial',
> '$model', '$yr_blt', '$km', '$price',
> ### '$hours',
> ### '$details', '$location', '1', '$tstamp', '$style');";
> ### }
> ###
> ### }
>
> Any thoughts? Enlightenment?
>
> Thanks
>
> --
> Richard Whitney   *
> Transcend Development
> Producing the next phase of your internet presence.
> [EMAIL PROTECTED]   *
> http://xend.net*
> 602-971-2791
>   * *   *
> *  *  *__**
>  _/  \___  *
>  *  /   *\**
>   */ * *  \
> **/\_ |\
>  /   \_  /  \
> /  \/\
>/  \
>   /\
>  /  \
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Empty Query

2003-02-25 Thread Richard Whitney
### I have this:
###
### [serial]
### [model]
### [yr_blt]
### [km]
### [price]
### [hours]
### [details]
### [location]
### double[style]

All of the 1 are the variables being passed, the word is hardcoded for clarity


What I get half the time:   Couldn't insert dataQuery was empty
###
### The variables are obviously being passed
###
### Here's my insert query:
###
### if($img == ""){$sql = "INSERT INTO vehicles ( `id` ,`serial`,  `model` ,
### `yr_blt` , `km` , `price` , `hours` , `details` , `location` , `img`,
### `tstamp`,
### `style`)
### VALUES ('', '$serial',
'$model', '$yr_blt', '$km', '$price',
### '$hours',
### '$details', '$location', '0', '$tstamp', '$style');";
### }
### else
### {
###
###
$file_dir="/services/webpages/o/f/offroad-imports.com/public/uploads/mogs/$serial";
### if (!is_dir($file_dir)){
### umask(000);
### mkdir($file_dir,0777);
### }
### else{
### umask(000);
###
### $path = $file_dir . "/1.jpg";
### move_uploaded_file($img, $path)or die('Could not upload photo');
### $sql = "INSERT INTO vehicles ( `id` ,`serial`,  `model` , `yr_blt` ,
`km`
### ,
### `price` , `hours` , `details` , `location` , `img`, `tstamp`, `style`)
### VALUES ('', '$serial',
'$model', '$yr_blt', '$km', '$price',
### '$hours',
### '$details', '$location', '1', '$tstamp', '$style');";
### }
###
### } 

Any thoughts? Enlightenment?

Thanks

-- 
Richard Whitney   *
Transcend Development
Producing the next phase of your internet presence.
[EMAIL PROTECTED]   *
http://xend.net*
602-971-2791
  * *   *
*  *  *__**
 _/  \___  *
 *  /   *\**
  */ * *  \
**/\_ |\
 /   \_  /  \
/  \/\
   /  \ 
  /\
 /  \


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php