Jump to content

paul2463

Members
  • Posts

    955
  • Joined

  • Last visited

    Never

Everything posted by paul2463

  1. Because they are allowed to vote on many articles, you will need the 'VotedFor' table to bridge the 'many to many' gap between the 'users' and 'products' tables. IMHO you will have to take the hit on size.
  2. where is $headers initialised? the two lines above append data to the end of $headers, not initialise the variable try $headers = "Content-type: text; charset=iso-8859-1\r\n"; $headers .= "From:".$name." / ".$email."\r\n";
  3. PHP is a server side script, all variables are set at the server before being given over the the client Javascript is a client side script working with what it has been given to change a php variable and maintain it as a php variable then php server side has to do the change, hence you would have to pass it back to php, allow it to make the change and then pass it back to the client so in other words javascript cannot change the value of a php variable
  4. means that function display_value () { some code } does not exist
  5. why write it this way? not the answer to your question, just a coding question if (!fopen($File, "r")) { } else { echo $File . "<br>"; } why not just use if (fopen($File, "r")) { echo $File . "<br>"; }
  6. $query = "SELECT * FROM object WHERE object_name = '$result' AND proj_id = '$proj'"; //get all rows with this information $result = mysql_query($query) or die(mysql_error()); $count = mysql_num_rows($result); //count the rows returned, if it doesnt exist in the DB then it will be 0 if ($count == 0) { //for conditional checking it should be == (= assigns a value to a variable)
  7. the easiest way to do it it is to make the form go to another pure php page that does the inserting etc then when complete returns you to the main page, this will then clear the $POST variable and then it will not re-insert the same data.
  8. instead of using $query = "SELECT * FROM table where whatever"; mysql_query($query) or die ("Error in query" .mysql_error()); use $query = "SELECT * FROM table where whatever"; echo($query);
  9. case is a mysql reserved word put back ticks around it `case` int(11)
  10. you could write a javascript funcion such as this to do it for you function validateDate(var datestring) { var returnvar = false; if(parseDate(datestring)) //check to see if it is a valid date { var brokenDate=datestring.split(”-“); //break the datestring up if (brokenDate[0] > 2001) //check the year is greater than 2001 { //check months and days(max) here, if all good make returnvar = true } } return returnvar; } [/code not done all the coding but given you a start
  11. you problem is in here $query = "SELECT * FROM user WHERE username= $username"; $result = mysql_query($query); try using $query = "SELECT * FROM user WHERE username= '$username'"; //variables should have single ticks on them $result = mysql_query($query) or die ("error in query" . mysql_error()); //would tell you where the error is
  12. echo date("r"); //Fri, 01 Aug 2008 12:57:07 +0100
  13. print_r($_POST) should have printed out what is in the $_POST array, it will still fail in your query because nothing has changed - did oyu not get an echoed out result of the print_r() function???
  14. $_SESSION['qty']=$quanty; if that is a direct copy from your code, it doesnt work because quantity is spealt wrong!!!
  15. you did it for all the rest so why did you not put single ticks around the last sessions variable? try $sql = "INSERT INTO topics(title, body, user_id) VALUES('" . $_POST['title'] . "', '" . $_POST['message'] . "', '" . $_SESSION['USERID'] . "')"; mysql_query($sql) or die(mysql_error());
  16. bretticus is correct the elseif statement is redundant change it ofr a straight else such as } } else { echo "<br><br>"; echo "<b>That number is already taken.</b>"; echo "<br><br>"; }
  17. you are missing a closing brace for your first if statement try changing these couple of lines <?php $nr++; endforeach; } else { ?> for <?php $nr++; } //closes the last if/else statement endforeach; // end your foreach statement } //end the first if statement prior to last else else { ?>
  18. <?php $string = "jlknlkj4223"; function getnumber($string) { $count = -1; for ($i = 0; $i <= strlen($string); $i++) { if(!is_numeric($string[$i])) { $count++; } } $return = substr($string,$count,strlen($string)); return $return; } echo getnumber($string);//prints out 4223 ?>
  19. it is telling you that $id does not exist
  20. $query = "SELECT * FROM dvd ORDER BY dvd_id DESC"; $result = mysql_query($query) or die ("Error in query " . mysql_error()); while ($row = mysql_fetch_assoc($result)) { echo "$row['name'] </BR>"; } echo "NEW";
  21. Have a look <a href="http://lists.evolt.org/archive/Week-of-Mon-20050214/169524.html"> Here </A>
  22. then you have connected to the wrong database or the table does not in fact exist, i know oyu have posted the create table code, but has it been created inside the database you are calling it from?
  23. this might seem a silly question but is the database you are trying to connect to called "mydbusername" or have you just not remembered to reset it to what the database is called???? or have you changed that bit for this forum??
×
×
  • 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.