473,320 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

create a sequence in MySQL, with mysql variable?

This might be fairly easy to do and I think I've seen the code before,
but I haven't seen many good examples of this. Of course Pear::DB
probably uses this code in some of its API, probably in dealing with
auto-increment indexes and prepared statements.

Maybe I'm off base here, but I'm looking for something like this:
(psuedo-code)
Of course the seq table only needs 1 row holding id, which is
updated.
select id from tbl;
// get result resouce and do fetch, store value in $myid
set @myvar = $myid + 1; // can php send to MySQL with a query? (
never seen this )
update myseq set id=@myvar // send this statement through in a
update/query

// for use in PHP code
$newSeqVal = $myid +1

A link to an example would be great.
TIA

Jan 8 '07 #1
0 1517

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: lkrubner | last post by:
I have a webserver through Rackspace. I create a domain. I create an FTP user. I upload some files. I create a database called testOfSetupScript and then I create a database user named setup. I...
3
by: mh | last post by:
Hello, I'm trying to create a table from a PHP script. >From what I read in my book about PHP and MySQL I should do something like that: $sql_query="CREATE TABLE '$num' ( 'variable1' ...
0
by: I.P. | last post by:
Hi, it's my story. I have two 4.0.14 mysql server on one machine with win XP Professional polish version. First acts as master: on port 3300 Second acts as slave: on port 3301 below my...
0
by: I.P. | last post by:
No one has replied to my post. ----- Original Message ----- From: "I.P." <jancio_wodnik@wp.pl> To: <mysql@lists.mysql.com> Sent: Monday, August 18, 2003 1:01 PM Subject: mysql 4.0.14 +...
0
by: tdmailbox | last post by:
I have the following microsoft SQL statement that inserts 25 new records in sequence. However I am trying to modify this to work in MySQL. I cant seem to get the variable decleration right. I...
9
by: expect | last post by:
Hello, Trying to get this MySql create table command to work, no luck. create sequence serial; CREATE TABLE outbound ( source char(100) default '', destination char(100) default '', sport...
0
by: awebguynow | last post by:
This might be fairly easy to do and I think I've seen the code before, but I haven't seen many good examples of this. Of course Pear::DB probably uses this code in some of its API, probably in...
4
by: kudinesh | last post by:
how to create a sequence menttioned below..for number generators. CREATE SEQUENCE sequ START WITH 1 INCREMENT BY 1
2
by: RolfK | last post by:
Dear ALL, I need some help on xsl:sequence. I'm using the Altova XSLT processor, but I'm quite confident it is not an processor issue. It's probably my bad knowledge of xslt 2.0. I have probably...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.