Jump to content

kristijan.jurkovic

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

kristijan.jurkovic's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. You have in each query 3 attributes which are pulled out except in this one SELECT `cont`, 'about_us_en' as REF FROM `about_us_en` add '' to correct the selection and it should be fine: SELECT `cont`, 'about_us_en', '' as REF FROM `about_us_en`
  2. tnx for info.. didnt know that... i m not rly using procedural code so i assumed that was wrong.
  3. first-> your mysqli functions are wrong (i am assuming that u r trying to use PHP MySQLi class) //connection: $mysqli = new mysqli($host, $user, $psswd, $db); //query: $query = $mysqli->query($sql); here is the whole manual: http://www.php.net/manual/en/class.mysqli.php and for sql try query with something like this: SELECT manufacturer, COUNT(manufacturer) AS ShowNumber FROM sales WHERE manufacturer = '{$row[manufacturer]}' GROUP BY manufacturer HAVING ( COUNT(manufacturer) > 1 )
  4. here you go: http://www.verot.net/php_class_upload.htm it has nice functions and great documentation as well.
  5. for that you will also have to specify form enctype to "multipart/form-data": <form method="post" action="file.php" enctype="multipart/form-data"> <input type="file" name="image_file" /> <input type="submit" name="submit" value="Upload Image" /> </form> //this is file.php if(isset($_POST['submit'])){ //directory in which your file will be uploaded $target_path = "images/"; $target_path = $target_path . basename( $_FILES['image_file']['name']); if(move_uploaded_file($_FILES['image_file']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['image_file']['name']). " has been uploaded"; //this is file name which you can store in database $file_name = $_FILES['image_file']['name']; /* Code for storing file name into db */ }else echo "Something went wrong =)"; }
  6. yeah i know that. as i said before php null is not equal to sql null therefore you cannot insert it via variable. you can try to build your query by checking if var is empty .... smthing like this: $workphone = trim(mysql_real_escape_string($_POST['workphone_txt'])); $query = "INSERT INTO table (field1,field2,field3) VALUES('field1','field2', "; if(!empty($workphone)){ $query .= "'$workphone')" } else{ $query .= " NULL )";}
  7. well NULL is a marker which specifies that data does not exists in the field. alternatively u can put default value of the field in db as NULL so if u dont input anything in it it will be NULL
  8. u see that function accepts only 1 input so u 'd have to do it through the loop somehow or 1 by 1 =) for sql insert: SQL is a string based language. SQL's NULL must be represented by NULL with no quotes so query should be like this: INSERT INTO foo SET bar = NULL; however if you try to insert the PHP NULL directly into the query, it will add zero characters to the query
  9. <?php function checkVars($var){ if(empty($var)){ $var = NULL; return $var; }else{ return $var; } } ?> EDIT: by the way if u r trying to put null variables directly to db with query it will add zero chars to the query and will leave u with blank or syntax error.. depends if u ll quote it or not
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.