[PHP-DB] MySQL: did anyone start a transaction?

2009-05-08 Thread Bogdan Stancescu
Hello all, I asked this question on php-general last month (http://marc.info/?t=12404923034&r=1&w=2), and received some answers -- but I was directed to this list, so here. My question is: can I tell programatically whether the next query I'm going to execute is already part of a transaction,

[PHP-DB] Re: Adding a log file

2003-11-05 Thread Bogdan Stancescu
$Addcart() -- is Addcart() a function (in which case you should remove the dollar sign) or are you specifically trying to do some magic there by running a function whose name is stored in that variable? Bogdan Robert Sossomon wrote: I am seeing some errors with a program I wrote and I need to

Re: [PHP-DB] PHP Newbee Question

2002-07-02 Thread Bogdan Stancescu
orthy MCP, CCNA > Network Administrator > Community Health Services > [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > > >>> Bogdan Stancescu <[EMAIL PROTECTED]> 07/02/02 10:15AM >>> > Variable names are case-sensitive in PHP - try $HTTP_POST_VARS["fir

Re: [PHP-DB] Column headers

2002-07-02 Thread Bogdan Stancescu
odbc_num_fields() and odbc_field_name() in this case :-) Bogdan Casey Allen Shobe wrote: >Whoops, should have been more clear. > >I'm looking for something to work with ODBC, and also Sybase. I'm already >fetching the data fine, but can't figure out how to get the column headers. > >On Tuesda

Re: [PHP-DB] Column headers

2002-07-02 Thread Bogdan Stancescu
For MySQL, see mysql_num_fields() and mysql_fetch_field() at http://www.php.net HTH Bogdan Casey Allen Shobe wrote: >How can I get the column headers from a query? > >For example, on a 'select blah, blah2, blah3, something as blah4 from >whereever', I would want the blah, blah2, blah3, blah4

Re: [PHP-DB] PHP Newbee Question

2002-07-02 Thread Bogdan Stancescu
Variable names are case-sensitive in PHP - try $HTTP_POST_VARS["first"] - or, for new versions of PHP, $_POST["first"]. In another train of thoughts, please use the proper e-mail address - I'm sure I'm not the only one using filters to automatically move mail to folders and your although proba

Re: [PHP-DB] fopen() question

2002-06-06 Thread Bogdan Stancescu
Also, if you check many URL's from the same script, make sure neither PHP nor the browser times out. For PHP, set_time_limit() and for the browser echo a space and flush() after each test. Bogdan Bogdan Stancescu wrote: > Try $fp=@fopen( etc > > Bogdan > > Tony wrote: &g

Re: [PHP-DB] fopen() question

2002-06-06 Thread Bogdan Stancescu
Try $fp=@fopen( etc Bogdan Tony wrote: >I have a database and I am writing a script to auto-update some information >in the database. >That requires me to read data from database, find the URL, read the URL, >find the information I want, then update it in the database. >My problem is, for examp

Re: [PHP-DB] sql and week starting ending numbers (dates)

2002-06-01 Thread Bogdan Stancescu
SELECT FROM_DAYS(TO_DAYS(purchaseDate)-DAYOFYEAR(purchaseDate)+WEEK(purchaseDate)*7) will hopefully return the date you need. You'll have to enclose all that in a DATE_FORMAT to get a printable date tho. Last minute note: you might have to subtract 1 from the last term because I guess MySQL st

Re: [PHP-DB] JOIN statement not producing expected output

2002-05-20 Thread Bogdan Stancescu
Well, the first question is "what's the expected output"? If you're trying to get, say, title from table1 and rating from table2 and identify the books in table1 by the unique field "id" and in table2 by the field "book_id", then this is what you should have to end up with: SELECT t1.title, t2

Re: [PHP-DB] returning all rows

2002-05-20 Thread Bogdan Stancescu
them by city. But it only returns one row > >"Bogdan Stancescu" <[EMAIL PROTECTED]> wrote in message >[EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > >>Just lose the "WHERE city=\"$city\" in the SQL. >> >>Bogdan >> >>Todd

Re: [PHP-DB] returning all rows

2002-05-20 Thread Bogdan Stancescu
Just lose the "WHERE city=\"$city\" in the SQL. Bogdan Todd Williamsen wrote: >I know I have asked this silly question before, but forgive me since I have >been a bit rusty with PHP lately > >So how do I return all rows? > >I have this: > >$sql= "SELECT id, city, date FROM meetings WHERE city =

Re: [PHP-DB] variable interpolation in mysql queries

2002-02-26 Thread Bogdan Stancescu
PS. You should consider using mysql_fetch_row() or at least mysql_fetch_array() for perforance reasons. B Bogdan Stancescu wrote: > $query="query"; > $result=mysql_query($query); > $pd=mysql_result($result); > > Notice the zig-zag - $query is first on the left side,

Re: [PHP-DB] variable interpolation in mysql queries

2002-02-26 Thread Bogdan Stancescu
$query="query"; $result=mysql_query($query); $pd=mysql_result($result); Notice the zig-zag - $query is first on the left side, then on the right side, then $result is first on the left side, then on the right side. Bogdan Ryan Snow wrote: >Hi, Im kinda new to this list. Can anyone tell me wh

Re: [PHP-DB] Performance Improvements

2002-02-23 Thread Bogdan Stancescu
uld use single quotes so they're not checked for variables. HTH Bogdan Bogdan Stancescu wrote: > My first suggestion: replace all split() calls with explode() calls. > > Bogdan > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DB] Performance Improvements

2002-02-23 Thread Bogdan Stancescu
My first suggestion: replace all split() calls with explode() calls. Bogdan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DB] Instest of add, subtract.

2002-02-23 Thread Bogdan Stancescu
Well, there are quite some differences difference between the results these two pieces of code yield. Let's see what your sql query would be for the first version, replacing $deposit in $query: UPDATE wt_users set bank_points + $user_depositset points - $user_deposit WHERE uid={$session["uid"]

Re: [PHP-DB] DB question

2002-02-23 Thread Bogdan Stancescu
No, at 1000+ you shouldn't have problems, almost no matter what database/data you're using. You may start getting slowdowns at 100,000+ users if you have a lot of data and probably 500,000+ if you have the reasonable data usually required. Anyway, using a different database for each user would

Re: [PHP-DB] Using checkbox in php problem

2002-02-23 Thread Bogdan Stancescu
This is only part of the solution, but you should be aware that "==" is a comparison operator whereas "=" is the assignment operator. Bogdan Killer Angel Clark wrote: >I add a checkbox in my page and will use the check result on another page. >If it is checked, it has no problem. However, if i

Re: [PHP-DB] Sample Warehouse Management System Codes?

2002-02-18 Thread Bogdan Stancescu
I'm constantly amazed how people can post such e-mails without first checking freshmeat - it really takes longer to write the e-mail, you know? This is what I came up with - out of sheer curiosity - in less than a minute, by clicking on freshmeat, typing "warehouse" and clicking on the project

Re: [PHP-DB] limit sytax error

2002-01-21 Thread Bogdan Stancescu
Quoting from the MySQL manual: In MySQL Version 3.23, you can use LIMIT # to ensure that only a given number of rows are changed. So then, it's LIMIT # instead of LIMIT #,# Obviously, the way around it would be using WHERE instead of LIMIT, but I don't know your table structure so I can't provid

Re: [PHP-DB] Automatic Listboxes

2002-01-15 Thread Bogdan Stancescu
You'll have to submit the data. Just that instead of pushing "go", you can get JavaScript to do that. For instance, You'll then have to check whether you have any field empty and, if so, echo the same form again, with the empty element populated. The final form

Re: [PHP-DB] Sanitizing user input for interaction with DB.

2002-01-13 Thread Bogdan Stancescu
I've started a thread on the topic some time ago on the php list, after some extensive reading and testing and these were the main conclusions: 1.1. ALWAYS pass "addslashed" values and always pass them quoted in the SQL statement. That is "insert into table1 set id='$id'" even if $id is known to a

Re: [PHP-DB] Re: Defining Arrays

2002-01-13 Thread Bogdan Stancescu
(Well, actually $text[1] should be "e" ;-) ) Bogdan Bogdan Stancescu wrote: > Why don't you try > $denc[]=substr($text,$i,1); > > Not to mention that $text[1] already is "h". > > Bogdan -- PHP Database Mailing List (http://www.php.net/) To

Re: [PHP-DB] Re: Defining Arrays

2002-01-13 Thread Bogdan Stancescu
Why don't you try $denc[]=substr($text,$i,1); Not to mention that $text[1] already is "h". Bogdan Thomas \"omega\" Henning wrote: > Something i forgot > when i echo("$denc[1]"); then it types Array out !!! > "Thomas "Omega" Henning" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">new

Re: [PHP-DB] processing data from mysql queries with php

2002-01-11 Thread Bogdan Stancescu
I don't know for sure if this works, but you may try simply adding a line with the name of the variable in the PHP code. For example, this works - I don't know, however, if it works with multiple lines: HTH Bogdan Keith Posehn wrote: > Quick question for you guru's out there: > > I have a se

Re: [PHP-DB] help on mulit query

2002-01-06 Thread Bogdan Stancescu
Just echo a link of the form Click for lyrics and use the incoming song_id in lyrics.php to get it from the database. Bogdan Barry Rumsey wrote: > I did not see that ( I must be blind hehe ). One other question , I have the > lyrics also stored in the database, how can I create a link so that w

Re: [PHP-DB] help on mulit query

2002-01-06 Thread Bogdan Stancescu
You seem to be doing it fine as far as I can see, except for "song_id" which should be "songs_id" in the query... Bogdan Barry Rumsey wrote: > Hi > I have three tables set out below: > > xp_artist: artist_id , artist _name > xp_sings: artist_id , songs_id > xp_songs: songs_id , song_name , lyr

Re: [PHP-DB] Probably an easy question - blank search fields (PHP & MySQL)

2002-01-06 Thread Bogdan Stancescu
$result = mysql_query("select * from equipment where (category='$category') and (description like '%$description') and (roomloc='$roomloc') and (quantity like '%$quantity') and (serialno like '%$serialno') and (patdue like '%$patdue')",$db); Gary Smith wrote: > Hiya, I'm writing a backend

Re: [PHP-DB] Fixed Quote Marks in Inputs

2002-01-04 Thread Bogdan Stancescu
Bogdan Stancescu wrote: > Ok, finally found a valid argument! :-) > > What if the user enters "I'm aware that 2>3!"? > > Bogdan Tested it - it works. However, you'll have big problems if you'll ever need to echo the data. Consider this example: Ente

Re: [PHP-DB] match

2002-01-04 Thread Bogdan Stancescu
Why would this be a problem (i.e. the fact that a user may insert "" in a form field)? If you're worried about security (i.e. users adding JavaScript code) you can always htmlspecialchars() the string... Bogdan louie miranda wrote: > Hi is it possible to match a certain string when a user subm

Re: [PHP-DB] Fixed Quote Marks in Inputs

2002-01-04 Thread Bogdan Stancescu
Ok, finally found a valid argument! :-) What if the user enters "I'm aware that 2>3!"? Bogdan Jonathan Hilgeman wrote: > And I apologize if I came off as ultra-defensive/rude. I had a bad day, a > bright idea, and then felt like someone was tearing it to pieces. This is > like the PHP soap ope

Re: [PHP-DB] Fixed Quote Marks in Inputs

2002-01-04 Thread Bogdan Stancescu
Ok, seems like I misjudged you and I apologize for that. I haven't changed my opinion about the very issue we've been discussing - only wanted to post the sentence above, just for the record. Bogdan Jonathan Hilgeman wrote: > Apparently, the experienced way is to store them with slashes, which

Re: [PHP-DB] Fixed Quote Marks in Inputs

2002-01-04 Thread Bogdan Stancescu
Ok, as I said before, you can store whatever you please in your database. However, please don't "speak as an experienced web programmer" when not longer than three hours ago you finally found a solution to store quoted text in a database. Bogdan Jonathan Hilgeman wrote: > I realize that part -

Re: [PHP-DB] Fixed Quote Marks in Inputs

2002-01-04 Thread Bogdan Stancescu
2 characters, it takes up 6, but since many fields we > all use won't ever contain quotes, I see it as a more than reasonable > trade-off. > > I personally consider it a bad habit to use slashes unless you're dealing > with regexes. And not everybody does it that way. &g

Re: [PHP-DB] Fixed Quote Marks in Inputs

2002-01-04 Thread Bogdan Stancescu
bad habit to use slashes unless you're dealing > with regexes. And not everybody does it that way. > > - Jonathan > > -Original Message- > From: Bogdan Stancescu [mailto:[EMAIL PROTECTED]] > Sent: Friday, January 04, 2002 1:41 PM > To: Jonathan Hilgeman > Cc:

Re: [PHP-DB] Fixed Quote Marks in Inputs

2002-01-04 Thread Bogdan Stancescu
That would be because this way you'll end up with the proper data in the database instead of HTML-encoded strings. Plus it's the proper way to do it -- everybody does it this way and it's a good habit. Bogdan Jonathan Hilgeman wrote: > I thought I made it somewhat clear: > > when I'm dealing wi

Re: [PHP-DB] Fixed Quote Marks in Inputs

2002-01-04 Thread Bogdan Stancescu
Those are two different things. You never mentioned your HTML problem, that's why nobody adressed it. So, the proper way to do it is: 1. Insert into the database using addslashes(); 2. Use stripslashes() after retrieving the data if you need to; 3. Use htmlspecialchars() for displaying the data i

Re: [PHP-DB] Please help asap

2002-01-04 Thread Bogdan Stancescu
In the printf() line after "5 6 7" you try to print "%s" 24 times but only provide 10 values. That may have something to do with it... Bogdan Jeff Moncrieff wrote: > Hello > > I am trying make a script fatch my data form my mysql database. I use > this script but when execute it is says > Wa

Re: [PHP-DB] querystring text

2002-01-04 Thread Bogdan Stancescu
rawurlencode() does this trick. Matthew Tedder wrote: > Quick question for anyone who knows, > >Is there a PHP function to make data safe for sending in the query string? > > $var = "something or other"; > > // TODO: What is function to translate $var for querystring compatibility? > > print

Re: [PHP-DB] The file '/tmp/phpxw2cJS' must be in the database directory or be readable by all

2002-01-03 Thread Bogdan Stancescu
Do you have control over where the file to be loaded is located? If so, simply create a directory in your user's home, and do what the error message says :-) HTH Bogdan Hayan Al Mamoun wrote: > I have this error when I try to execute "Load Data Infile .. " > statement, although temp directory

Re: [PHP-DB] Multiple select list box to search mysql database

2002-01-01 Thread Bogdan Stancescu
Bogdan Stancescu wrote: > In HTML: > > (note the name has PHP-like array definition) > > In PHP: > for ($i=0;$i if ($i==0) { > $q_cond="where"; > } else { > $q_cond="or"; > } > $query.="$q_cond MANUFACTURER LIKE 

Re: [PHP-DB] Multiple select list box to search mysql database

2002-01-01 Thread Bogdan Stancescu
In HTML: (note the name has PHP-like array definition) In PHP: for ($i=0;$i Hi everyone, > > This is a php and mysql question... > > I've spent days trying to figure this out and can only find help on one or > the other.. not both things that I'm trying to do. > > I have a table called inventory

Re: [PHP-DB] odbc date

2001-12-30 Thread Bogdan Stancescu
If everything else fails, you can retrieve unix_timestamp(date) and use PHP's date() to format the output. HTH Bogdan George Nicolae wrote: > for Win32(NT) and MSAcess 2000, whenever you retrieve a date column/field, > php will automatically convert it to '/mm/dd hh:mm:ss' format regardles

Re: [PHP-DB] Iinserting into 250 tables filtered data automaticly. delaytime??

2001-12-29 Thread Bogdan Stancescu
You actually have a time-out problem on exec_stmt(), because the for() can't loop without executing all of the statements within. You may want to start looking for ways to increase the time php waits for mysql to execute a query. Just to make sure I'm not senselessly babbling here, what does the

Re: [PHP-DB] Weigting a random selection

2001-12-28 Thread Bogdan Stancescu
Yup, that's the roulette selection, as they call it. It's pretty simple, actually. The idea is that you use a concept similar to a roulette table, just that the sectors aren't equal -- they're equal to their respective weights. The procedure is as follows: 1. Assign the weighting to each of the p

Re: [PHP-DB] Passing parameter in Paging

2001-12-28 Thread Bogdan Stancescu
So many suggestions, so little time! The URL thing is a great idea if you don't have any problems with users seeing the variables being passed by your script (not that this was the issue I had in mind when I suggested my solution - it just skipped my mind). So, if you'd rather implement the forms

Re: [PHP-DB] Passing parameter in Paging

2001-12-28 Thread Bogdan Stancescu
I don't understand why you won't use forms with buttons and hidden controls since you know about this solution. I have two suggestions along this line: 1. You probably don't want buttons on the page -- you may use image icons instead (similar to a tape recorder's "play" and "fast forward" for next

Re: [PHP-DB] expiration date help

2001-12-26 Thread Bogdan Stancescu
Jason Dulberg wrote: > I need to stick a little expiration date into a part of my site but can't > seem to get it going properly. Your logic is ok -- DATE_ADD() is the function to work with. You don't give any details about the actual problem you're having, but from the e-mail it seems you're go

Re: [PHP-DB] Selecting last row

2001-12-21 Thread Bogdan Stancescu
select * order by id desc limit 1; (obviously, id must be the field you yourself order the table by in your mind when you say "last row") Necro wrote: > What query can I use to select the last row in a table?? > > Andrew > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe,

Re: [PHP-DB] mysql table layout help needed

2001-12-20 Thread Bogdan Stancescu
A sample of what you were trying would have been helpful... If I understood your problem right, the solution is a piece of code like this: \n\n"); while ($myrow=mysql_fetch_row($result)) { $colcount++; if ($colcount==$desiredcolcount) { $colcount=0; } if (!$colcount