Jump to content
MakeWebGames

need help wtih this function


Snatchy

Recommended Posts

I keep getting an error on this query for some reason. i can't work it out.

function edit_entry_form()
{

$cph=mysql_query("SELECT * FROM phonebook WHERE id={$_POST['id']}");
$ph=(mysql_fetch_row($cph))

print "[b]Editing Record[/b]
<form action='newentry.php?action=editentrysub' method='post'>
<input type='hidden' name='userid' value='{$_POST['id']}' />
Category: <input type='text' name='category' value='{$ph['category']}' />

Business Name: <input type='text' name='business_name' value='{$ph['business_name']}' />

Address: <input type='text' name='address' value='{$itemi['ph']}' />

Phone: <input type='text' name='phone' value='{$itemi['ph']}' />

Fax: <input type='text' name='fax' value='{$itemi['ph']}' />

Mobile: <input type='text' name='mobile' value='{$ph['mobile']}' />

E-Mail: <input type='text' name='email' value='{$ph['email']}' />

Website: <input type='text' name='website' value='{$ph['website']}' />

Logo: <input type='text' name='logo' value='{$ph['logo']}' />

Description: <input type='text' name='description' value='{$ph['description']}' />

</form>";
}
Link to comment
Share on other sites

Re: need help wtih this function

Missing a ;

 

function edit_entry_form()
{

$cph=mysql_query("SELECT * FROM phonebook WHERE id={$_POST['id']}");
$ph=(mysql_fetch_row($cph));

print "[b]Editing Record[/b]
<form action='newentry.php?action=editentrysub' method='post'>
<input type='hidden' name='userid' value='{$_POST['id']}' />
Category: <input type='text' name='category' value='{$ph['category']}' />

Business Name: <input type='text' name='business_name' value='{$ph['business_name']}' />

Address: <input type='text' name='address' value='{$itemi['ph']}' />

Phone: <input type='text' name='phone' value='{$itemi['ph']}' />

Fax: <input type='text' name='fax' value='{$itemi['ph']}' />

Mobile: <input type='text' name='mobile' value='{$ph['mobile']}' />

E-Mail: <input type='text' name='email' value='{$ph['email']}' />

Website: <input type='text' name='website' value='{$ph['website']}' />

Logo: <input type='text' name='logo' value='{$ph['logo']}' />

Description: <input type='text' name='description' value='{$ph['description']}' />

</form>";
}
Link to comment
Share on other sites

Re: need help wtih this function

ok no problem, here it is

 

function edit_entry_begin()
{
print "Editing An Entry

You can edit any aspect of this record. 

<!--<form action='newentry.php?action=editentryform' method='post'>
<input type='submit' value='Edit Record' /></form>
OR--> 
Enter a Record ID to edit:
<form action='newentry.php?action=editentryform' method='post'>
Record: <input type='text' name='id' value='0' />

<input type='submit' value='Edit Record' /></form>";
}
/////////////////////////////////////////////
//this is the function i can't get to work///
/////////////////////////////////////////////
function edit_entry_form()
{

$cph=mysql_query("SELECT * FROM phonebook WHERE id={$_POST['id']}");
$ph=(mysql_fetch_row($cph))

print "[b]Editing Record[/b]
<form action='newentry.php?action=editentrysub' method='post'>
<input type='hidden' name='userid' value='{$_POST['id']}' />
Category: <input type='text' name='category' value='{$ph['category']}' />

Business Name: <input type='text' name='business_name' value='{$ph['business_name']}' />

Address: <input type='text' name='address' value='{$itemi['ph']}' />

Phone: <input type='text' name='phone' value='{$itemi['ph']}' />

Fax: <input type='text' name='fax' value='{$itemi['ph']}' />

Mobile: <input type='text' name='mobile' value='{$ph['mobile']}' />

E-Mail: <input type='text' name='email' value='{$ph['email']}' />

Website: <input type='text' name='website' value='{$ph['website']}' />

Logo: <input type='text' name='logo' value='{$ph['logo']}' />

Description: <input type='text' name='description' value='{$ph['description']}' />

</form>";
}
Link to comment
Share on other sites

Re: need help wtih this function

ok after i added the ; i get this error

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/bendorg/public_html/addbook/newentry.php on line 60

 

But it prints the fields but with no info in them...

blank, so to speak.

Link to comment
Share on other sites

Re: need help wtih this function

you see this is what really shits me in these forums..... DO ANY OF YOU ACTUALLY TRY SOMETHING BEFORE YOU POST IT.... clearly you all aren't that great at coding, i appreciate the help but unless you can provide a definite fix could you please stop posting maybe's. i am a busy man with a lot of work on and don't have time to spend 8 hours in a forum talking with people that MIGHT know how to fix the problem... if your going to post a fix...... MAKE SURE IT ***** WORKS!!!

as for this thread, i add the ;, i take the ; away and i still get errors, so if someone would be as so kind as to help me, i would much appreciate it, if you only THINK you know what your doing, don't bother!

Link to comment
Share on other sites

Guest Anonymous

Re: need help wtih this function

Next time, please consider your words *very* carefully. A number of very skilled and very talented people have offered assistance and time however due to your lack of understanding and general apparent incompetence you have been unable to understand a) what the error message means, b) how to actually report and error, c) ask for help and d) retain some semblance of control over your language.

Link to comment
Share on other sites

Re: need help wtih this function

MAKE IT READABLE....

Now TRY this and HELL NO i didn't try it HOW COULD WE....we only have 1 function from a whole page...

 

function edit_entry_form()
{

$cph2 = sprintf("SELECT * FROM phonebook WHERE id = '%u' ",
   ($_POST['id']));
       $cph = mysql_query($cph2);

$ph = mysql_fetch_array($cph);

echo "[b]Editing Record[/b]";
echo "<form action='newentry.php?action=editentrysub' method='post'>";
echo "<input type='hidden' name='userid' value='".$_POST['id']."' />";
echo "Category:";
echo "<input type='text' name='category' value='".$ph['category']."' />";
echo "
";
echo "Business Name:";
echo "<input type='text' name='business_name' value='".$ph['business_name']."' />";
echo "
";
echo "Address:";
echo "<input type='text' name='address' value='".$itemi['ph']."' />";
echo "
";
echo "Phone:";
echo "<input type='text' name='phone' value='".$itemi['ph']."' />";
echo "
";
echo "Fax:";
echo "<input type='text' name='fax' value='".$itemi['ph']."' />";
echo "
";
echo "Mobile:";
echo "<input type='text' name='mobile' value='".$ph['mobile']."' />";
echo "
";
echo "E-Mail:";
echo "<input type='text' name='email' value='".$ph['email']".' />";
echo "
";
echo "Website:";
echo "<input type='text' name='website' value='".$ph['website']."' />";
echo "
";
echo "Logo:";
echo "<input type='text' name='logo' value='".$ph['logo']."' />";
echo "
";
echo "Description:";
echo "<input type='text' name='description' value='".$ph['description']."' />";
echo "
";
echo "</form>";
}
Link to comment
Share on other sites

Re: need help wtih this function

Snatchy, your expectations and demands seem to dictate that you require paid help. Free help comes and goes.

Most of us here are busy too. Sorry we couldn't be as accommodating as think we should be. I do agree there were some pointless posts in this thread.

I do know that keeping your cool and being appreciative of the help you have received is the best way to encourage others to step up to the plate with what might be even better help for you.

 

Good luck, and I hope you get the problem solved. ;)

Link to comment
Share on other sites

Guest Anonymous

Re: need help wtih this function

Let me bring a machete to your intellectual thicket...

All the people here who help out or indeed even try to help out do so for no financial gain whatsoever. That includes the senior programmers, moderators, administrators and site owner.

We do it because we enjoy doing it. We actually like showing people with lesser skills how to fix problems -- up to an extent.

That extent is apparent here. Please, tell us exactly why we should waste our valuable time -- and I do mean valuable -- in looking through code with no indentation or indication as to exactly what line is what when a simple comment marker would suffice.

If you can't be bothered to give us a very good indication as to where your problems lie (although, personally I'm very sure exactly where they lie), then I suggest you choose one or ideally both of the following:

RTFM / JFGI

And never *ever* make the mistake of assuming these people are not intelligent. They get frustrated at people's inability to post sensible clear error reports as they have been here for a lot longer than you.

Floydian posted a very clear definition of one of your problems and simple missing semi-colon attributes another error. Just how many errors do we have to deal with in your code?

(OT - Anybody care to place a wager -- number of errors in a given time frame?)

Link to comment
Share on other sites

Re: need help wtih this function

yes it was pointed out that a ; was needed and yes i did take the information on board.

Is what's frustration is someone trying to belittle someone else with a whole heap of fancy words.

I may work in Lamens terminology but at least it's blunt and stright to the point and people don't need to grab adictionary or a thesauras to understand what i'm saying.

Believe it or not I help out a lot of people, it may not have so much to do with coding but I do resolve a lot of hardware issues for a lot of people and 80% is volunteer help.

I don't volunteer help unless i know i'm going to be able to fix the problem.

It would be like a mechanic TRYING to fix your car for you and telling you to put sugar in the fuel tank to make it run better.

My frustration levels stem from people being just plain ignorant.

 

Posted by: shedh

Insert Quote

nar it can't be

Code: [select]

print "Editing Record

it still needs to print out the form and rest of the page

Posted on: Today at 06:52:27 AM

Posted by: Snatchy

Insert Quote

print "Editing Record

Posted on: Today at 06:49:46 AM

Posted by: Tezza`

Insert Quote

What is line 62?

NOW I WAS ASKED AND POSTED 3 TIMES WHAT LINE 62 WAS. i asked, they asked, i replied, and then what do you know, they asked the same question again. but hey, that's right, they are super intelligent beings.. pmsl.

It's like if your an idiot you should have a sign on your head so then we wouldn't bother asking you in the first place.

This post isn't about bugs and errors in my game, it's about why a function won't work and if you READ properly you can see why i got so frustrated to begin with.

so now if your over your way over explanated hissy fit can we get back on the topic?

Link to comment
Share on other sites

Guest Anonymous

Re: need help wtih this function

 

Is what's frustration is someone trying to belittle someone else with a whole heap of fancy words.

Oo - I forget, there are a few of of us here with a decent number of years upon us so we tend to be a little more articulate than some.

 

I may work in Lamens terminology but at least it's blunt and stright to the point and people don't need to grab adictionary or a thesauras to understand what i'm saying.

Perhaps you should grab a dictionary. At least we have the ability to spell correctly (most of the time).

 

Believe it or not I help out a lot of people, it may not have so much to do with coding but I do resolve a lot of hardware issues for a lot of people and 80% is volunteer help.

Soopah

 

I don't volunteer help unless i know i'm going to be able to fix the problem.

You are going to tell me... that you never suggest a "Try this..." solution? pfft.

 

It would be like a mechanic TRYING to fix your car for you and telling you to put sugar in the fuel tank to make it run better.

More like a mechanic suggesting that you try reading the manual before starting said vehicle up.

 

My frustration levels stem from people being just plain ignorant.

Snap

Regarding the error on line 62... Did you actually look at the error?

 

Parse error: syntax error, unexpected T_PRINT in /home/bendorg/public_html/addbook/newentry.php on line 62

Lets just have a little look at this in detail shall we.

Parse error -- Okay, we can take that as read. PHP obviously has problems with it's parser here - If in doubt, check zend_language_parser.y (that's a yacc/bison script in the PHP sources).

Syntax error -- That's pretty obvious (I hope)

Unexpected -- Well lets see - Unexpected kind off gives you a bit of a clue here .. Something occurred that wasn't meant to ... which suggests that perhaps the fault was just before this point.

T_PRINT -- Aha -- now we get to the meat of the matter -- Anybody care to guess what this is -- For those of you not paying attention... this will be a print statement -- which (according to zend_language_parser.y is right-associative) narrows the problem even further confirming our earlier reasoning that the error actually points to something *before* this statement.

I'll gloss over the file and line number here ... although if anybody really wants a definition of these, feel free to consult somebody who gives a hoot.

Okay, so we have come to conclusion that the error - one of the most common and simplest, is not actually at the print statement, but must occur prior to that.

Now given that a context-free grammar like PHP skips whitespace outside of strings, we can therefore determine that the error in fact lies in the previous statement and NOT on line 62.

So while you may it very clever to just cry for help and quote an arbitrary line number, what you really need to is is something akin to the following:

---------------------------------------- BEGIN

I keep getting an error on this query for some reason. i can't work it out.

The error is :

Parse error: syntax error, unexpected T_PRINT in /home/bendorg/public_html/addbook/newentry.php on line 62

The lines surrounding this are as follows (line 62 being highlighted):

 

function edit_entry_form()
{
$cph=mysql_query("SELECT * FROM phonebook WHERE id={$_POST['id']}");
$ph=(mysql_fetch_row($cph))

// THE FOLLOWING IS LINE 62
print "[b]Editing Record[/b]
<form action='newentry.php?action=editentrysub' method='post'>
...";
}

 

BTW, I'm using the <game-engine or equivalent>. I've tried <this> and <that> but ended up with the same problem. I'm not sure about <a>, but I think it might be , but I really need some help.

 

---------------------------------------- END

 

Fine, I agree you managed to do at least some of this ... after a series of posts back, but again, I ask why. It would have been a lot simpler to document the whole process initially rather than waste your time and mine (not to mention the other posters).

 

Onto the second error -- I won't go into detail here, as F. has produced a clear topic on that very subject, but I would suggest that perhaps a different topic for this error ~may~ be appropriate. After all, It's a totally different class of error -- one PHP, one SQL (albeit a simple configuration failure at PHP level).

 

It's like if your an idiot you should have a sign on your head so then we wouldn't bother asking you in the first place.

 

Somebody pass me the rubber stamp - I have a hankering for some stampering ;)

 

This post isn't about bugs and errors in my game, it's about why a function won't work and if you READ properly you can see why i got so frustrated to begin with.

 

[me=Nyna]sighs[/me]

 

I'm rapidly getting tired of this .. As Site Admin, I have a responsibility to read nigh on every post, and while I may skip certain authors, or certain subjects from time to time, I do step in and stir things up when I feel people are being overly vituperative. (Look it up).

 

so now if your over your way over explanated hissy fit can we get back on the topic?

 

Hissy fit .. lmao .. and just what part of the solution did you not understand? You say you have a game. Great, congratulations. No please, do us all a favor, and read the replies carefully, read the relevant manual pages, experiment, before even considering to run a public facing game.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...