AyKay47
Members-
Posts
3,281 -
Joined
-
Last visited
-
Days Won
1
Everything posted by AyKay47
-
no, I meant primary key, you can combine fields in a primary key definition. No, you would them a unique key. You can only have one primary key. Edit: yeah I see what you are saying now Adam, since `id` is already the PK, yeah you would have to make any others unique keys.
-
no, I meant primary key, you can combine fields in a primary key definition. No, you would them a unique key. You can only have one primary key.
-
funster's reply sums it up nicely. But to add, when thinking about what field(s) to make a PK, ask yourself what fields must be unique in the table. typically the auto_incrementing field would be the PK because it must be unique, but as funster stated, you can also use compound PK's if a group of fields must be unique. e.g. if there can be multiples of the member_id and question_id fields separately, but there can only be one unique paring of the two fields, assign the pair a PK.
-
yes, just don't store sensitive data in them like a user id or password, they can be hijacked.
-
you would have to calculate the width needed and set that to #container using something like JS yes.
-
*pseudo code* if($('#email') == '') alert("blank email"); put this wherever you check the values of the inputs in JS.
-
image upload to server, writing image name to mysql
AyKay47 replied to ggw's topic in PHP Coding Help
than getextension() does not exist at the time that it is called. -
need to have a fixed width set.
-
this has to do with the width of #container; http://jsfiddle.net/9LsEs/1/
-
why not use sessions?
-
this line should be the problem: if ((($_POST['username'])&&($_POST['password']))=="admin") the parenthesis are a little out of whack. should read: if (($_POST['username'] == 'admin') && ($_POST['password'])) but, what exactly is supposed to equal 'admin'? Both fields? learn to space your code out to make it more readable. If this does not solve your issue, post any errors that you are receiving.
-
it won't
-
Can't Understand Why This Code is'nt Working
AyKay47 replied to JamesThePanda's topic in PHP Coding Help
instead of saying "i'm getting an error", please post the error and the line(s) that it refers to. -
Can't Understand Why This Code is'nt Working
AyKay47 replied to JamesThePanda's topic in PHP Coding Help
echo '<tr><td><input type="checkbox" name="uid[]" value="'.$row['ID'].'" /></td><td>"'.$row['filename'].'"</td><td>"'.$row['title'].'"</tr>'; -
well then the html is being removed by something in your script. Can you post the relevant code please.
-
Can't Understand Why This Code is'nt Working
AyKay47 replied to JamesThePanda's topic in PHP Coding Help
double quotes don't need escaped when the string is wrapped in single quotes, the backslashes will be interpolated as literal backslashes. echo '<input type="submit" name="formSubmit" value="Submit" />'; -
field values are not wrapped in back-ticks, they are wrapped in quotes. $query = mysql_query("UPDATE `home` SET `welcometitle`= '$welcometitle', `welcomesection`= '$welcomesection', `infotitle`='$infotitle', `infosection`= '$infosection',`videotitle`= '$videosection'") or die(mysql_error());
-
Can't Understand Why This Code is'nt Working
AyKay47 replied to JamesThePanda's topic in PHP Coding Help
make sure the checkbox input names are in array format. Post the relevant code please. -
if(isset($welcometitle && $welcomesection)) && !empty($welcometitle && $welcomesection)) should read: if(isset($welcometitle, $welcomesection) && !empty($welcometitle) && !empty($welcomesection))
-
Can't Understand Why This Code is'nt Working
AyKay47 replied to JamesThePanda's topic in PHP Coding Help
There is an error in your SQL, if you had proper error handling established you would know this. The only way that double quotes can be used as an identifier quoting character is when the SQL mode include ANSI_QUOTES. Either way you are using single quotes to encase the field `id`. Use either back-ticks or none at all. Also, to use the IN clause here, $ids would need to be a comma delimited list of values, which I doubt it is. $ids = $_POST['uid']; $con = mysql_connect("localhost","root",""); mysql_select_db("product", $con); $ids = intval($ids); //sanitize data $sqlout = mysql_query("SELECT * FROM product2 WHERE ID = '$ids'") or die(mysql_error()); //select only the fields that you are going to use while ($sqlres = mysql_fetch_assoc($sqlout)) { echo $sqlres['filename'] . " " . $sqlres['title']; } mysql_close($con); -
1. never insert $_POST values directly into a query, this makes the script vulnerable to SQL injection. Run the values through mysql_real_escape_string if the values are strings, and either cast them to type int or use intval for integers. 2. To answer your actual question, this is a concatenation error, the line in question should read: $sql = "INSERT INTO sample (id,firstname,lastname,bio,gender) VALUES ('{$_POST['ID_']}','{$_POST['firstname']}','{$_POST['lastname']}','{$_POST['bio']}','{$_POST['gender']}')";
-
How to echo an image if value is equal to or greater than....
AyKay47 replied to scouser77's topic in PHP Coding Help
if($variable >= number) { echo '<img src="/path/to/img" />'; }