Jump to content

Concatenation of a random integer


zarathu

Recommended Posts

[quote author=hitman6003 link=topic=115838.msg471785#msg471785 date=1164166407]
Works fine for me.

Are you getting any error messages?  What result are you getting?
[/quote]


$newID = rand(10000,90000);

//inserts shittles... watch me rule again.
$bullshit = "INSERT INTO $mySQL_table ($mySQL_idField, $mySQL_strField) VALUES ($newId, $data)";
//$query = mysql_query($bullshit);
echo($bullshit);

^ That's the ACTUAL code that I'm trying to execute, but it just won't work.  Also, Philip, your method doesn't work either.  When I try to echo($newID) on its own, it prints it fine.  It just won't concatenate.
Link to comment
Share on other sites

maybe you need to use single quotes around your values:


$bullshit = "INSERT INTO $mySQL_table ($mySQL_idField, $mySQL_strField) VALUES ('$newId', '$data')";

if that doesn't do the trick put at the top of your code: error_reporting(E_ALL); and also: $query = mysql_query($bullshit) die("Error ". mysql_error() ." with query ". $bullshit); 

that should help in finding out what is causing the problem.
Link to comment
Share on other sites

[quote author=KingPhilip link=topic=115838.msg471793#msg471793 date=1164166930]
If that is your actual code... it's because you have 2 different variables:
$newID
$newId
(notice the D's are different)
[/quote]

Oh my God, I KNEW it was because of something BLATANTLY stupid!


Thanks!  >.<

Ugh, I'm used to compiler errors because I'm a Java/C/C++ programmer.  Gah!
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • 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.