Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You appear to be using a lot of quotation marks in places that you shouldn't be using them in. It is funny how you can code something for 5 hours and then try to debug it for 2 hours because of a simple quotation mark! It's funny and very depressing at the same time :(</p> <p>Ok, let's fix the code a little bit!</p> <p>Database</p> <pre><code>$link=mysql_connect($host, $username, $password); if (!$link) { die('Could not connect: ' . mysql_error()); } // make foo the current db $db_selected = mysql_select_db($database); if (!$db_selected) { die ('db is not selected : ' . mysql_error()); } </code></pre> <p>Notice how I stripped all of the quotation marks out of the code? That will help with database connection and selection.</p> <p>Now let's move onto the actual inserting of the information into the database!</p> <pre><code>$query = "INSERT INTO clanovi ('Ime', 'Prezime', 'Firma', 'Adresa', 'Telefon', 'Fax', 'Mobitel, 'Email', 'Web_stranica') VALUES ( $field1, $field2, $field3, $field4, $field5, $field6, $field7, $field8, $field9)"; </code></pre> <p>Again, I stripped all of the quotation marks. Plus I removed backticks and replaced with a ' and also took the '' off of your table name - You should nly use quotation marks when not using a variable. </p> <pre><code>//Correct VALUES ($field1, "textnotvariable", $field2... //Incorrect VALUES ("$field1", "textnotvariable", "field2"... </code></pre> <p>The same goes with echo statements. Here's an example...</p> <pre><code>$myname = "MrJustin"; //Correct echo $myname; //or echo "My name is ". $myname .", it's nice to meet you!"; //Incorrect echo "My name is $myname, it's nice to meet you"; </code></pre> <p>You'll notice how I used ". $myname ." - that tells the echo to break away from using text, and to pass a variable! :) That to me is the best way to explain how quotations will break a code.</p> <p>Oh, and you should ALWAYS sanitize your inputs/outputs when using foreign code. I would do some Google searching on that one, and then chat us back up if you run into problems with that!</p> <p>Hopefully this helps, and happy coding!!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload