Reply to Re: Novice needs help :)

Your name:

Reply:


Posted by Jerry Stuckle on 11/17/06 15:45

casper christensen wrote:
> Jerry Stuckle skrev:
>
>>casper christensen wrote:
>>
>>>Well
>>>
>>>Using the insert tag, it returns the value"0", any idea why. Obviously
>>>it doesnt get the last inserted id (tried Last_insert_id.. too)
>>>
>>>casper
>>>
>>>Jerry Stuckle skrev:
>>>
>>>
>>>>casper christensen wrote:
>>>>
>>>>
>>>>>I'm not asking you or anyone to go throught the entire code to find a
>>>>>bug. There is no bug!
>>>>>I need to know how to fetch the created Id. The must be some "standard"
>>>>>code to get "load" values from the database.
>>>>>
>>>>>casper
>>>>>
>>>>
>>>>I'm not sure what you mean by fetch the "created id". Are you talking
>>>>about after your user adds a new row to the table? If that's the case,
>>>>see http://www.php.net/manual/en/function.mysql-insert-id.php.
>>>>
>>>>But you're also not using "standard" MySQL functions. MySQLQuery is not
>>>>a PHP function. The one defined in PHP is mysql_query. I have no idea
>>>>what your function is doing.
>>>>
>>>>--
>>>>==================
>>>>Remove the "x" from my email address
>>>>Jerry Stuckle
>>>>JDS Computer Training Corp.
>>>>jstucklex@attglobal.net
>>>>==================
>>>
>>>
>>First of all, does the table have an autonumber column? Since you were
>>looking for an ID, I suspected it did, but my assumption may be wrong.
>>
>>Also, did you call it after making the insert, using the same connection
>>as the INSERT (and without closing the connection)?
>>
>>--
>>==================
>>Remove the "x" from my email address
>>Jerry Stuckle
>>JDS Computer Training Corp.
>>jstucklex@attglobal.net
>>==================
>
>
> Please do me a favour and try to add a link at my site, then you'll see
> what I need and you might be able to help me
>
> http://www.affiliatesjunction.net/directory.php?ax=add
> This will take you to the form
>
>
> casper
>
>

(Top posting fixed)

Ok, I tried it. But first of all, you have what could be a problem on
this page. In it, you have:

<form action="/directory.php?ax=insert" method="post" ...>

Here you're performing a POST operation, but passing a parameter
(ax=insert) as a GET parameter. This isn't good, and may not work in
all instances. If you want to pass the parameter, a much better way
would be to pass it as a hidden field, i.e., in your form have:

<input type="hidden" name="ax" value="insert">

Secondly, after I add the row, your next page comes back with two
complete pages - DOCTYPE and all. Obviously not good at all.

Now, I see were you're saying the insert id is zero. But not being able
to see the actual insert code or database, it's impossible to tell
exactly what's going on. I have no idea, for instance, where you placed
the code to get the insert id.

Additionally, you're using some other functions - MySQLQuery, for
instance - which aren't part of the native interface to MySQL and I have
no idea what they do. Do they, for instance, open a connection, do the
insert, then close the connection? I have no idea because you never
showed that code.

Additionally, does the database have an autonum column? It needs to in
order to get an insert id. Again, I don't know, because you haven't
posted the database schema.

We need to know all of these things in order to be able to better tell
what's going on.

P.S. Please don't top post!

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация