PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I have tried different ways to populate table "p_keys" from table "programs" but to no avail.
The following code is a last resort. It does not generate any errors or records fpr that matter
First of all, don't execute queries inside loops. Now, it looks like you're able to retrieve data just fine, which leaves your INSERT query as the culprit. On the surface the query looks fine. Have you tried running the query manually? Have you looked at mysql_error()?
1. INSERT ... VALUES has a syntax for adding multiple rows in a single query
2. SQL injection on $password, use mysql_real_escape_string()
3. What you really need in this case is INSERT ... SELECT
Thanks for the suggestions I had tried the INSERT ... SELECT before without trying to catch the errors .
I ended up making p_keys a single column table, running the php code, and then adding back the columns I need.
Mhm, just a quick note: don't leave code like this:
die('Invalid query: ' . mysql_error());
in production code. This is a really nice thing to leave for hackers and can greatly* help them with gaining access to your database (* only if you have an SQL injection vulnerability in the query)
“Things need not have happened to be true. Tales and adventures are the shadow truths that will endure when mere facts are dust and ashes and forgotten” so spake Neil Gaiman
Dream has many negative aspects to his personality. He is sometimes slow when dealing with humor, occasionally insensitive, often self-obsessed, and is very slow to forgive or forget a slight. He has a long history of failed romances, and is both directly shown and implied to have reacted very harshly to some of his breakups
Ah, but that's his past. The character portrayed in the comic is shown to grow more and more human. He goes back to fix his past mistakes, with compassion and love and a feeling for what is right which are much like our own (even though he is not human at all).
Anyway - how did we turn this topic into a literary analysis of Sandman? Must be a dream
Lonestarjack wrote:I have tried different ways to populate table "p_keys" from table "programs" but to no avail.
The following code is a last resort. It does not generate any errors or records fpr that matter