Forum Home
Press F1
 
Thread ID: 43524 2004-03-17 09:17:00 Off Topic: Any PHP/MYSQL gurus out there?? prayingmantis (5416) Press F1
Post ID Timestamp Content User
223288 2004-03-19 01:58:00 Hey prayingmantis,

PHP/MySQL right up my alley.

I can't read all your code, can you use the code brackets to display it? It's quite hard. I'll try and make out what I can from it.


Noel Nosivad
Noel Nosivad (389)
223289 2004-03-19 02:03:00 > I can't read all your code, can you use the code
> brackets to display it? It's quite hard. I'll try
> and make out what I can from it.

Sorry about the pre tags, I did not know that the above would happen :( :|

If you have any problems reading the tags, let me know, & I will make a new thread or if a mod is online, could they take the pre tags out for me?
prayingmantis (5416)
223290 2004-03-19 02:30:00 Hey praying,

I may be incorrect in some code reading here but I've had a bad day. So bare with me.

for(reset($HTTP_POST_VARS);

should be

for(reset($HTTP_POST_VARS));

I don't like

next($HTTP_POST_VARS)) {

try

(next($HTTP_POST_VARS)) {
or
next($HTTP_POST_VARS) {

Praying, just have to say, PHP is the code, and no HTML unless it's included within the <?php ?> brackets will be counted. It's quite hard determining line numbers for codes. I still may need to check the code over again, but those were the errors I noticed.

All your VALUES() is incorrect format.

'".$_POST['job_details_priority']."' tells me by this code that you want input to show up ".job_details_priority." is that correct with quotes and period (dot) included.

The problen is the single quote at the start with the single quote after the first [

Well that's how I think the problem is done, I haven't actually tested the code myself.


Noel Nosviad
Noel Nosivad (389)
223291 2004-03-19 02:59:00 Just noticed maybe another problem,

remove the ; (semi-colons) and just use , (commas), semi-colons mark the END of the line/code and means the next line will be start of new line/code.


Noel Nosivad
Noel Nosivad (389)
223292 2004-03-19 05:02:00 Hello Noel Nosviad :)

Sorry for the delay in replying, as me & dad have been looking at my script & seeing what is wrong & we have done a few wee fixes etc...(See my next post… ;))

> I may be incorrect in some code reading here but I've
> had a bad day. So bare with me.

I know what you mean; trying to do this has been very frustrating! So I understand where you are coming from ;)

> for(reset($HTTP_POST_VARS);
>
> should be
>
> for(reset($HTTP_POST_VARS));
>
> I don't like
>
> next($HTTP_POST_VARS)) {
>
> try
>
> (next($HTTP_POST_VARS)) {
> or
> next($HTTP_POST_VARS) {

Ok, I will change the above latter on :)

> All your VALUES() is incorrect format.
>
> '".$_POST['job_details_priority']."' tells me by
> this code that you want input to show up
> ".job_details_priority." is that correct with quotes
> and period (dot) included.
>
> The problen is the single quote at the start with the
> single quote after the first [

Ok
prayingmantis (5416)
223293 2004-03-19 05:03:00 Ok, now I am getting this error message:

>>>Notice: Undefined variable: query in c:\program files\apache group\apache\htdocs\copy of form . php on line 13

Here is line 13:

>>>>mysql_query($query) or die("Insert Failed!");

& $query Is in line 43: which is:

$query = "INSERT INTO job_details(job_details_priority, job_details_client, job_details_phone, job_details_mobile,job_details_address, job_details_job_description,job_details_status, job_details_contact, job_details_client_email, job_details_due_date, job_details_quote, job_details_deposit, job_details_recd)
VALUES('" . $_POST['job_details_priority'] . "','" . $_POST['job_details_client'] . "','" . $_POST['job_details_phone'] . "','" . $_POST['job_details_mobile'] . "','" . $_PO ST['job_details_address'] . "','" . $_POST['job_details_job_description'] . "','" . $_PO ST['job_details_status'] . "','" . $_POST['job_details_contact'] . "','" . $_POST['job_d etails_client_email'] . "','" . $_POST['job_details_due_date'] . "','" . $_POST['job_det ails_quote'] . "','" . $_POST['job_details_deposit'] . "','" . $_POST['job_details_recd' ] . "')";

Any idea what is now wrong???
prayingmantis (5416)
223294 2004-03-20 04:44:00 Hey prayingmantis,

Lets make it easier on ourselves, but more coding :(

Do we really need $_POST['job_details_priority']?
why not $_POST['priority']? where the information being posted is named "priority"
. . . and then why not $priority = $_POST['priority'];

This way we can just use $priority and can validate the information as well as altering it within that variable .

$query = "INSERT INTO job_details(priority, client, phone) VALUES ('" . $priority . "', '" . $client . "', '" . $phone . "')";

I'm not sure whether the problem here is PressF1 bug problem or your code, it shows $_P O ST with the added spaces as well as other spaces added .

It might be a good idea to not copy and paste from here :P unless you check first .


Noel Nosivad
Noel Nosivad (389)
223295 2004-03-20 08:48:00 Hello Noel Nosivad

I should of updated this post last night, letting you know that I fixed the above problem, but due to that I was having internet problems all off yesterday, I just gave up on the net & I forget about this post, sorry about that :8}:8}

> Do we really need $_POST['job_details_priority']?
> why not $_POST['priority']? where the information
> being posted is named "priority"
> . . . and then why not $priority = $_POST['priority'];

I think the two reason why I am doing like $_POST['job_details_priority']; Not $_POST['priority'];

1 . Because I made the form up before I did the DB & the form text files are formatted like that & I just coped that over to the DB

2 . I think because I have more then one table to get to work( I have 4 tables in total), & maybe easy to debug as well? So I know what table/text field to work

> I'm not sure whether the problem here is PressF1 bug
> problem or your code, it shows $_P O ST with the
> added spaces as well as other spaces added .

Hmmm weird, because I can see it as $_POST, which is the same in my code

Another question:

When it says something like

> > Notice: Undefined variable: job_details in c:\program files\apache group\apache\htdocs\show_infor . php on line 73

Or

> > Notice: Undefined index: job_details_priority in c:\program files\apache group\apache\htdocs\copy of form . php on line 43

Do I need to worry about any thing?
prayingmantis (5416)
223296 2004-03-20 09:25:00 Hello Noel Nosivad

One more question for tonight :)

If my boss miss out a required field, what I want to do is show an error message saying that he did

Here is the code:

////////////////////////////////
// If they didn't include all the required fields set a variable and keep going .
////////////////////////////////
$notall = 1;

?>


<? if ($notall == 1) { ?>


<FONT COLOR="red">Please fill out all fields</FONT></P>
<? } ?>

The problem is that "Please fill out all fields" is showing before any thing is submitted

Any ideas?
prayingmantis (5416)
223297 2004-03-20 09:26:00 > <!-- Let them know that they have to fill in all the
&gt; blanks -- >
> <? if ($notall == 1) { ? >
>

<FONT COLOR="red" > Please fill out all
> fields</FONT > </P >
> <? } ? >

Note: this bit is in the HTML code
prayingmantis (5416)
1 2 3 4 5