phone number not storing in database

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!

Moderator: General Moderators

Post Reply
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: phone number not storing in database

Post by Celauran »

First thing I see is you're closing PHP tags far too early.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: phone number not storing in database

Post by Celauran »

I don't see any inserts in there, only selects. This code doesn't save anything to the DB.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: phone number not storing in database

Post by Celauran »

$_POST['customer_phone'] is an array. You're using a loop to send the messages, but not to record them to the DB.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: phone number not storing in database

Post by Celauran »

Yes. You have an array of values and you want an entry for each, right?
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: phone number not storing in database

Post by Celauran »

There are also repeated chunks of code in your form. These could easily be abstracted away to a function.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: phone number not storing in database

Post by Celauran »

I'm looking at this specifically.

Code: Select all

$sqlCommand = "SELECT id, customer_name, customer_phone FROM repairs WHERE customer_phone LIKE '%44%' AND customer_name BETWEEN 'a' AND 'e' GROUP BY customer_name";
If you ever wanted to change that, you'd need to change is in a number of places.
Post Reply