Re: [PHP-DB] Executing a query in the future

2007-09-13 Thread Brad Bonkoski

cron?

or if on windows they have a scheduler, and then just run a command line 
PHP script that checks due dates and sends out emails as necessary, not 
sure you need a web page to send out email notifications...

-B

Mark Bomgardner wrote:

I am looking for a way in PHP to execute a query at some point in the
future.  Here is my example;  I am writing a page to checkout laptop
computers to instructors.  I want the person that checks out the laptop to
receive an email when the laptop is close to being to, but I want this to be
automated.  I don't want to have to pull up a page everyday to run the
query.  Is there something that can run in the background  that can run a
page at varying intervals?

markb

  


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] use of str_split

2007-08-09 Thread Brad Bonkoski
Looks like the function str_split() is a PHP 5 addition, so I guess it 
might be because you are using php 4?


You can also do this with substr() function...
Something like this:
?php
   $str = abcdefg;
   $arr = Array();
   for($i=0; $i strlen($str); $i++) {
   $arr[] = substr($str, $i, 1);
   }
   print_r($arr);
?

HTH
-B

Asim wrote:

Hi
   
  when i try to use this function
   
   
  str_split()
   
  it shows me as invalid function
   
   
  what is solution
   
  i want to split certain length of string into an array
   
   
  bye
   
   
   



Asim Jamil  - 0092 345 4025907, Pakistan
   
-
Luggage? GPS? Comic books? 
Check out fitting  gifts for grads at Yahoo! Search.
  


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] use of str_split

2007-08-09 Thread Brad Bonkoski

This was my initial thought too, but from the manual:

If /delimiter/ is an empty string (), *explode()* will return *FALSE*. 
If /delimiter/ contains a value that is not contained in /string/, then 
*explode()* will return an array containing /string/.


So, this would not satisfy the functionality the OP alluded to.
-B


Bastien Koert wrote:

explode(delimiter, $string);
 
 is the correct function
 
 
 
Bastien Date: Thu, 9 Aug 2007 04:53:53 -0700 From: [EMAIL PROTECTED] To: php-db@lists.php.net Subject: [PHP-DB] use of str_split  Hi  when i try to use this function   str_split()  it shows me as invalid function   what is solution  i want to split certain length of string into an array   bye  Asim Jamil - 0092 345 4025907, Pakistan  - Luggage? GPS? Comic books?  Check out fitting gifts for grads at Yahoo! Search.

_
Connect to the next generation of MSN Messenger 
http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-ussource=wlmailtagline
  


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] MySQL BETWEEN Problems

2007-05-18 Thread Brad Bonkoski

I think you need between 'A' and 'F%'

Aa is between A and F
but 'Fa' is not between 'A' and 'F'
(but 'Ez' would be between 'A' and 'F')
-B


Tony Grimes wrote:

I'm using BETWEEN to return a list all people who's last names fall between
A and F:

 WHERE last_name BETWEEN 'A' AND 'F' ...

but it's only returning names between A and E. The same thing happens when I
use:

 WHERE last_name = 'A' AND last_name = 'F' ...

Shouldn't this work the way I expect it? What am I doing wrong?

Tony

  


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] MySQL BETWEEN Problems

2007-05-18 Thread Brad Bonkoski

Try using the substr, since you are only comparing the first letters...
(sorry I did not reply all on the other email, Dan)

i.e.

select name from users where substr(name, 1, 1) = 'A' and substr(name, 
1, 1) = 'B';


-B
Dan Shirah wrote:
So just change it to WHERE last_name BETWEEN 'A' AND 'G' .  That'll 
get you

Aa-Fz :)


On 5/18/07, Tony Grimes [EMAIL PROTECTED] wrote:


We tried that and it didn't work. We've also tried every combination of
upper and lower case too.

Tony


On 5/18/07 2:18 PM, Brad Bonkoski [EMAIL PROTECTED] wrote:

 I think you need between 'A' and 'F%'

 Aa is between A and F
 but 'Fa' is not between 'A' and 'F'
 (but 'Ez' would be between 'A' and 'F')
 -B


 Tony Grimes wrote:
 I'm using BETWEEN to return a list all people who's last names fall
between
 A and F:

  WHERE last_name BETWEEN 'A' AND 'F' ...

 but it's only returning names between A and E. The same thing happens
when I
 use:

  WHERE last_name = 'A' AND last_name = 'F' ...

 Shouldn't this work the way I expect it? What am I doing wrong?

 Tony




--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php






--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] echo

2007-03-29 Thread Brad Bonkoski

elk dolk wrote:

thanks to Chris and Dimiter,
I think I am close but still the problem is not solved, when I add

echo img src='/album/img/.$row[photoFileName].' / 
to the code as it was sugested by Dimiter there is parse Error :


PHP Parse error: syntax error, unexpected $end in 
C:\Inetpub\wwwroot\album\show.php on line 44

line 44 is end of the code just after /html

what does it mean?
  

probably you don't have a semi colon at the end of your echo line
nor is there and end double quote.



  
I am storing just the name of photos in the database and the photos are 
in /img folder  ,and there is no permissions issue. My testing server

is IIS And the path would be something like this : Inetpub\wwwroot\album\img
as I am running out of time! could someone complete this code just with 
one echo and img src so that I can retrive my photos ?



  

MySQL columns : photoID=seq number
   photoFileName=name of my photo like 3sw.jpg
   title=title
   description=short description
-


body


?php

$link = mysql_connect('localhost', 'root', 'pw');
if (!$link) {
 die('Not connected : ' . mysql_error());
}
  echo 'connected!';

$db_selected = mysql_select_db('album', $link);
if (!$db_selected) {
die ('Can\'t use foo : ' . mysql_error());
}


$query = SELECT * FROM photo;
$result=mysql_query($query);


while ($row = mysql_fetch_array($result)) 
{
  echo img src='/album/img/.$row[photoFileName].' / 
}



mysql_free_result($result);
?


/body
/html   



  
-
Looking for earth-friendly autos? 
 Browse Top Cars by Green Rating at Yahoo! Autos' Green Center.  
  


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Re: Creating a Table to line query results in php?

2007-03-03 Thread Brad Bonkoski
How can I create a table...or even something similar...to line information 
up?



echo table;
echo trthHeader1/ththHeader2/ththHeader N/th/tr;


while ($data = mysql_fetch_array($res))
{
$idfield = $data['IDFIELD'];
$name = $data['Name'];
$effect = $data['Effect'];
$category = $data['Category'];
$origin = $data['Origin'];
$image = $data['Image'];

echo img src=\image/$image\, $name, $effect, $category, $originbr;


echo trtdimg 
src=\image/$image/\/tdtd$name/tdtd$effect/tdtd$category/tdtd$origin/td/tr;


}

echo /table;

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem with ocilogon

2007-02-16 Thread Brad Bonkoski

Dominik Helle wrote:

Hi,

I've a problem with php-oci and I hope anybody can help me. I want to 
connect with ocilogon to an Oracle Database. If i call my php-Script 
in the browser, this error message turn up:


Warning: ocilogon() [function.ocilogon]: OCIEnvNlsCreate() failed. 
There is something wrong with your system - please check that 
ORACLE_HOME is set and points to the right directory in...


That is very funny, because if i activate the file on the command line 
- the connect is possible and no error message turns up.


FYI: My System:  Ubunutu 6, Apache 2 and php 5-with-oci  Oracle 
Database 10g (10.1.0.2).


Thank you for helping.

Dominik


I'm assuming since you mention the apache, this is a web application...
It looks like the ORACLE_HOME path is not know by apache/PHP.  So, you 
might try stopping apache, and doing something like 'source 
/etc/profile' or wherever your ORACLE_HOME env variable is set, and then 
restarting apache and trying again...

HTH
-B

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] SQL Query - Using variable from another SQL Query

2007-02-12 Thread Brad Bonkoski

Matthew Ferry wrote:

Hello Everyone

Got a simple / stupid question.
Worked on this all night. I'm over looking something very basic here.

The query event_time brings back the calendar id for each event that is 
pending in the future.
ie 12, 13, 14, 26  (There could be 100 of them out there)

The second query events needs to meet both reqirements.  
 1 - cal_category='501' 
 2 - cal_id= a number from the event_time query


I think i need to do a loop inside of a loop

Thanks...

Matt 



Here is my code: 


?php

$todays_year = date(Y);

$todays_month = date(m);

$todays_day = date(d);

$tstamp = mktime(0, 0, 0, $todays_month, $todays_day, $todays_year);

$event_time = mysql_query(SELECT cal_id FROM egw_cal_dates where cal_start  
$tstamp, $db);
  

This returns a mysql result set...not the actual data...
search php.net for the function mysql_fetch_array or others to actually 
*get* the data.

(Some good examples there will help you sort this out!)


$events = mysql_query(SELECT * FROM egw_cal WHERE cal_category='501' and 
cal_id='$event_time'\n, $db);



if ($event = mysql_fetch_array($events)) {

echo center\n;

echo HR\n;

do {

echo BFont 
Size='10'$event[cal_title]nbsp;nbsp;nbsp;nbsp;-nbsp;nbsp;nbsp;$event[cal_location]/B/Font\n;

echo BR\n;

echo $event[cal_description];

echo BR\n;

echo HR\n;

} while ($event = mysql_fetch_array($events));

} else {

echo No Public Events Are Currently Scheduled...;

}

?


  


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Installation Problem

2006-11-15 Thread Brad Bonkoski

Check out the installation instructions for Windows...
MYSQL support is not working with your PHP, if memory serves me 
correctly you just need to uncomment a dll in your php.ini file, but 
check out:

http://www.php.net/manual/en/ref.mysql.php

-B

Abdou Karim Jallow wrote:
I have just upgraded to PHP 5.2 from PHP 4. I am using Apache 2 with 
MYSQL.


Before the upgrade, everything was working well. (Was able to connect 
to my
MYSQL database from PHP interface. However, now with the same PHP 
codes, I

am not able to connect to the MYSQL database instead I am getting errors
such as:

*Fatal error*:  Call to undefined function mysql_connect() in
*C:\Program Files\Apache Group\Apache2\htdocs\viewusers.php* on line
*7

Line 7 is: $dbc = mysql_connect ('localhost') OR die ('Could not
connect to mysql: ' .mysql_error() );


*However, this was working fine before the upgrade. WHAT DO I NEED TO DO.

In a second attempt to fix the problem, I dited the system path to the
directory where php is installed. Now the error message is gone but still
cannot to the database. Whilst I tried to retrieve data from the database
using the PHP scripts, nothing comes from the database. Also I tried 
to post

but the data is not put in the data.base

Note when I upgraded to PHP 5, I still left the PHP 4 files in the 
computer.


PLEASE HELP ME



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Simple question on auto_increment

2006-11-13 Thread Brad Bonkoski

mario wrote:

Hello,

really a mysql question. Pls. help anyway.
 
Is there a simple, common way to implemt the following:

Say I have a table with a id autoincrement field.
I wish to insert a record but just ist id value, get back the id value,
use it to update the record.

Do I need three separate mysql queries? Is there some trick I may use?
Thanks Regards mario

  

www.php.net/mysql_insert_id --or-- www.php.net/mysqli_insert_id

(of course for your example to work all the other fields would have to 
be nullable)


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] textarea value assignment

2006-10-04 Thread Brad Bonkoski

[EMAIL PROTECTED] wrote:
Hello 


how I could assign a textarea with a variable value?
Although I tried to achieve an allocation like a 
normal input, but it does not work so I have no success with textarea.
 
The code looks like following fragment.


$problem_val = mysqlclean($_SESSION, problem_eb, 500, $connection);

textarea style=width: 320px; height: 150px; heigth=30 width=50 
cols=1 rows=1 name=problem_eb value=?php echo $problem_val?/textarea



Best regards, Joerg Kuehne

  
There is no value attribute of textarea...to put text in there, you 
place it between the textarea/textarea tags.

i.e.

textarea style=width: 320px; height: 150px; heigth=30 width=50 
cols=1 rows=1 name=problem_eb ?php echo $problem_val; ?/textarea

-B

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Page refresh and database updation

2006-09-26 Thread Brad Bonkoski

I'm sure there are many ways...
a few off the top of my head.
a). if there is some field or combination of fields that guarantee 
uniqueness then you can test for their existence before you insert.
b). When you insert the first time set some session variable to 
something, and then don't insert if that session variable exists.
c). have some middle page that does your insertion and then immediately 
redirects to another page which displays results, but has not more POST 
data associated with it, so refreshing that page will not cause a 
re-post of your data.


HTH
-B

Tamkhane, Pravin wrote:

Hi All,
I am a PHP newbie. I am using HTTP POST request to send some data to 
Apache and then using MySql to store that information. Once 
information is stored in MySql DB successfully, I display a result 
page. But the problem I am facing is that, if I refresh the result 
page displayed after database updation, the information is stored 
again in database which I don't want to. Please guide me on how I can 
avoid duplication of information in database on refreshing the page. 
Thanks in advance!


Regards,
Pravin


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] posting information from a textarea

2006-07-06 Thread Brad Bonkoski

stripslashes should not be needed...

if anything addslashes() may be needed if you have single quotes in the 
text area.
I would say step 1 is to echo out your insert query to the page before 
you even excute the insert, to verify the query, and that you are 
getting the proper information from the form.

-B

Dave W wrote:

I seem to be having a problem posting text from a text area. I have a 
form

that posts data into a database and there are input fields which seem to
post the data fine. I know this because the entry is changing in the
database, but the text area text doesn't seem to be posting. I double
checked to make sure i got the names right, but it still doesn't seem 
to be
working. Before I put it into the database I'm using stripslashes. I 
thought

that might of been the problem and I changed it to trim, but that didn't
work. In the database, the field that I'm putting it into is a 
longtext type

with fulltext.



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Select distinct field won't return distinct value

2006-06-06 Thread Brad Bonkoski

Perhaps you should fix your data model...

but with your current set up, try:
select cus_name, cus_id from customers group by cus_name order by 
cus_name asc

-Brad


Mohamed Yusuf wrote:


I want select distinct field and return value of that field, but I have
problem which is: select distinct returns duplicate value. eg, I wan 
select
distinct customer name and id from the customer table. one customer 
may have

different cus_ids since cus_ids are auto increment and depend on the
purchased items. so what I want is to select distinct customer name so 
that

I can print customer name and customer id once.

here is algorithm;

select distinct cus_name, cus_id from customers order by cus_name asc
While row is not empty do{
echoa href=\page?cus=cus_id\costomer name/abr /;
}



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] odbc_exec error

2006-06-01 Thread Brad Bonkoski



Scott Wettstein wrote:


I'm pretty new to PHP so I need help. I'm getting this error:

Error in updating SQL PHP Warning: odbc_exec() [function.odbc-exec]: SQL
error: [Microsoft][ODBC Microsoft Access Driver] Too few parameters.
Expected 2., SQL state 07001 in SQLExecDirect in
c:\Inetpub\wwwroot\shout.php on line 77

Lines 76 and 77:

$sql=UPDATE shout SET UserName=$laName,Message=$laMessage WHERE
Dat=$laDate;

$updating=odbc_exec($conn,$sql);



where $laName, $laMessage, and $laDate are from a POST. I've checked my
spelling a million times and changed the names of variables. Why is it still
complaining? Please help! 

 


it says a SQL error ;-)
I would check to see if you need quotes around your variables...
like:
$sql = update shout set UserName='$laName', Message='$laMessage' where 
-Brad

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] How can I get in PHP the number of files in a directory

2006-05-31 Thread Brad Bonkoski

http://www.php.net/manual/en/ref.dir.php

suad wrote:


Hi,

This is for reading a file:
?php
$handle = fopen(/home/rasmus/file.gif, r);
?

How can I get in PHP the number of files in the directory (rasmus)
and the files names in a loop?

Thanks
Suad



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] allow-url-fopen setting

2006-05-31 Thread Brad Bonkoski



Manoj Singh wrote:


Hello all,

Can i change the allow-url-fopen(php.ini variable) setting through php
code.

If any one knows how to do that, please help me.

Regards
Manoj


http://www.php.net/manual/en/ref.filesystem.php
from manual
Note: This setting can only be set in php.ini due to security reasons.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Combining Fields

2006-05-31 Thread Brad Bonkoski



Grae Wolfe - PHP wrote:


Good Day!
 I am trying to use my limited knowledge to create a VERY simple process to 
display some of the information in my table, allow a particular record to be 
selected, then opened on a page with text boxes to edit the information, 
after which the UPDATE command will be used to update the database.
 That being said, I have a way that I think this will work, but I don't 
have a unique record number in my table for each of the entries.  I have 
tried getting PHPMyAdmin to set this up, but I cannot seem to make it work. 
SO - I need to try to create that ID on the fly.  I figured I could just 
combine the first and last names to make this ID, but I am not sure what the 
syntax should be.  Here is the code I have dealing with defining the 
variables...


Any help or thoughts would be splendid!

while ($row = mysql_fetch_array($result)) {
$id = $row['last_name'],$row['first_name'];
$fname = $row['first_name'];
$lname = $row['last_name'];

$option_block .= option value=\$id\$lname, $fname/option;


 


Use the dot (.) for appending variables...
so it would be:
$id = $row['last_name'].$row['first_name'];
...or course if you want that would look like this: 'SmithAdam'
if you want 'Smith,Adam' as your id then:
$id = $row['last_name'].,.$row['first_name'];
-Brad

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Combining Fields

2006-05-31 Thread Brad Bonkoski



Grae Wolfe - PHP wrote:

Thank you Brad - That is what I was looking for, but now that I see how it 
behaves, I am thinking that it isn't going to work the way I wanted.  I need 
to then be able to pass the ID back to MySQL so that it will retrieve just 
the one record for editing.


I guess I need to go back to making the DB create an auto-incrementing ID 
number.  Hmmm...


Thanks!!

 

Well, the unique ID would probably be the *best* way to go, but you 
could also get the record with the below solution, of course this 
requires every combination of first and last name is unique...

if you do:
$id = Smith,Adam
Then:
list($fname, $lname) = explode(,,$id);
select * from table where first_name = '$fname' and last_name='$lname'
would do the trick...
Of course this has many what-ifs asociated with it...all of which 
would be taken care of with an auto-incrementing/primary key ID field 
for wach record ;-)


-Brad

Brad Bonkoski [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 


Grae Wolfe - PHP wrote:

   


Good Day!
I am trying to use my limited knowledge to create a VERY simple process 
to display some of the information in my table, allow a particular record 
to be selected, then opened on a page with text boxes to edit the 
information, after which the UPDATE command will be used to update the 
database.
That being said, I have a way that I think this will work, but I don't 
have a unique record number in my table for each of the entries.  I have 
tried getting PHPMyAdmin to set this up, but I cannot seem to make it 
work. SO - I need to try to create that ID on the fly.  I figured I could 
just combine the first and last names to make this ID, but I am not sure 
what the syntax should be.  Here is the code I have dealing with defining 
the variables...


Any help or thoughts would be splendid!

while ($row = mysql_fetch_array($result)) {
$id = $row['last_name'],$row['first_name'];
$fname = $row['first_name'];
$lname = $row['last_name'];

$option_block .= option value=\$id\$lname, $fname/option;



 


Use the dot (.) for appending variables...
so it would be:
$id = $row['last_name'].$row['first_name'];
...or course if you want that would look like this: 'SmithAdam'
if you want 'Smith,Adam' as your id then:
$id = $row['last_name'].,.$row['first_name'];
-Brad 
   



 



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] MySQL/PHP Left Join Question

2006-05-25 Thread Brad Bonkoski
Some good examples of how to deal with this in PHP have already been 
given, especially the associative array solution.


The question I have is with something like this, how do you weight out 
the pros/cons of code development versus speed?
i.e. for code development breaking the logic up into 2 queries would 
yield a much more readable result,  but speed wise what is better 
multiple queries with smaller more precise record sets, or having PHP 
parse through the result set to properly weed out duplicate titles based 
on the outer join applied?


This is assuming that there is no SQL construct to solve this problem, 
which personally I know of none.


-Brad

Andrew Darby wrote:


Hello, all.  I don't know if this is a php-mysql question or just a
mysql, but here goes:

I have a list of DVDs that my library loans out, and I'd like to allow
people to add comments to each item.  Since this list gets regenerated
periodically (it's extracted from another system, the library
catalog), there isn't a consistent ID in the dvd tables, so I'm using
the call number (which will look like DVD 2324) as the key.  Anyhow, I
join the tables like this to get all the DVDs and all the comments
associated with the DVDs:

SELECT distinct dvds.title, dvds.publisher, dvds.publication_date,
dvds.call_number,
comment.id, comment.parent_id, comment.comment, comment.name
FROM dvds
LEFT JOIN comment
ON dvds.call_number=comment.parent_id
WHERE dvds.title LIKE 'A%'
ORDER BY dvds.title

With this, I'll get results like

DVD 101A.I.   This movie rocked
DVD 101A.I.   This Movie stunk
DVD 102Adaptation  . . .
DVD 103After Hours . . .

When I loop in PHP through the records, of course, I want just the one
DVD with however many comments associated with it.  Is it possible to
do this (i.e., screen out DVD dupes) in MySQL, or do I have to do it
in PHP?

If this is a dumb question, my humblest apologies, and I'd be
interested if there was a better way to handle this . . . .

Andrew



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] MD5, MySQL, and salts

2006-04-17 Thread Brad Bonkoski
This begs the question of what would this method buy you over MD5? 
Some people have issue with like passwords looking the same with MD5 
encryption, also a one way hash.
But if you know the salt, then like passwords would also look the same, 
right?

-B

Giff Hammar wrote:


For an example, look at how UNIX/Linux stores regular login passwords. In
short, the salt is the first two characters in the password. When comparing
passwords, you take the salt and the user supplied password, encrypt, then
compare the two encrypted strings. If they match, the recently supplied
password matches the original. AFAIK, that is the only way to verify
passwords encrypted with a one-way algorithm.

Giff

-Original Message-
From: chris smith [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 17, 2006 4:36 PM

To: Sean Mumford
Cc: php-db@lists.php.net
Subject: Re: [PHP-DB] MD5, MySQL, and salts

On 4/18/06, Sean Mumford [EMAIL PROTECTED] wrote:
 


Hi Guys,
I'm working on securing user passwords in a MySQL 4 database with a 
PHP5 frontend. I remember being told in one of my classes (I'm 
currently a college junior) that the best way would be to hash a salt 
and the password together and then store the hash in the database 
instead of the plain MD5 hash. My question is, what is a good method 
for the server and the database to agree on a salt value to use? I 
know i could use a predefined variable, but I was wondering if 
something dynamic might be better (timestamp, current date, something like
   


that). Any ideas? Thanks in advance!

If it's a dynamic salt, how are you going to access it when you have to
compare ?

There was an article either on phpsec.org or shiflett.org which talks about
this.. can't find the link right now :(

--

Postgresql  php tutorials
http://www.designmagick.com/

--

 



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Manipulate an image automatically

2006-04-13 Thread Brad Bonkoski

query google about imagemagick tutorialsassuming you are using Linux...
-Brad

Henry Ortega wrote:


What is the quickest way to manipulate an image?

I have a 300x100 image of something (template), and I want text to be
inserted
to that graphic at a certain coordinate (e.g. lower right), how would I do
that?

 



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] session

2004-10-17 Thread Brad Bonkoski
I believe you need to pass the session variable along to the next page...
Something like:
On page 1:
if session is set
{
   $s = SID;
   echo a href=\page.php?$s\Link/a;
}
- Original Message - 
From: H. J. Wils [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, October 17, 2004 9:38 AM
Subject: [PHP-DB] session


sorry, forgot to change the subject :), just to be sure here is my 
question again..

Hi everybody,
For quite a while i'm struggeled with my session. It doesn't seem to work, 
can anyone help me?

This is my code:
page 1:
session_start();
$_SESSION[test] = tryin...;
if (isset($_SESSION[test]))
{
 echo a href='session2.php'next page/a;
 echo br.session_id();
}
page 2:
session_start();
if (isset($_SESSION[test]))
{
 echo $_SESSION[test];
}else
{
 echo No sessionvariable found..;
}
echo br.session_id().br;
On page two, there's always the 'no sessionvariable found...'-message, 
further the session id also changes... i dont understand what i am doing 
wrong...

_
Play online games with your friends with MSN Messenger 
http://messenger.msn.nl/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] session

2004-10-17 Thread Brad Bonkoski
Look at the URL when you pass it?  It does not show anything, in fact the 
session is still using cookies or other means to tansfer the data.
You should also be able to sniff the data being passed by the URL and not 
see any of the session data.

- Original Message - 
From: H. J. Wils [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Sunday, October 17, 2004 10:17 AM
Subject: Re: [PHP-DB] session


hey thanx it works, but
why is that? i mean, session are there to save data which te user cant 
see... isnt there another way to pass the SID? i have the feeling passing 
the SID trhough the url-paramters is harming the security, am i right?

From: Brad Bonkoski [EMAIL PROTECTED]
To: H. J. Wils [EMAIL PROTECTED], [EMAIL PROTECTED]
Subject: Re: [PHP-DB] session
Date: Sun, 17 Oct 2004 09:46:06 -0400
MIME-Version: 1.0
Received: from pb1.pair.com ([216.92.131.4]) by mc5-f14.hotmail.com with 
Microsoft SMTPSVC(5.0.2195.6824); Sun, 17 Oct 2004 06:47:55 -0700
Received: (qmail 35123 invoked by uid 1010); 17 Oct 2004 13:47:04 -
Received: (qmail 33188 invoked by uid 1010); 17 Oct 2004 13:46:19 -
X-Message-Info: JGTYoYF78jGDHqvDtc0+QckXsrFscNGe
Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
Precedence: bulk
list-help: mailto:[EMAIL PROTECTED]
list-unsubscribe: mailto:[EMAIL PROTECTED]
list-post: mailto:[EMAIL PROTECTED]
Delivered-To: mailing list [EMAIL PROTECTED]
Delivered-To: [EMAIL PROTECTED]
Delivered-To: [EMAIL PROTECTED]
Message-ID: [EMAIL PROTECTED]
References: [EMAIL PROTECTED]
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-Virus-Scanned: Symantec AntiVirus Scan Engine
Return-Path: [EMAIL PROTECTED]
X-OriginalArrivalTime: 17 Oct 2004 13:47:55.0249 (UTC) 
FILETIME=[E77EF610:01C4B44F]

I believe you need to pass the session variable along to the next page...
Something like:
On page 1:
if session is set
{
   $s = SID;
   echo a href=\page.php?$s\Link/a;
}
- Original Message - From: H. J. Wils [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, October 17, 2004 9:38 AM
Subject: [PHP-DB] session

sorry, forgot to change the subject :), just to be sure here is my 
question again..

Hi everybody,
For quite a while i'm struggeled with my session. It doesn't seem to work, 
can anyone help me?

This is my code:
page 1:
session_start();
$_SESSION[test] = tryin...;
if (isset($_SESSION[test]))
{
 echo a href='session2.php'next page/a;
 echo br.session_id();
}
page 2:
session_start();
if (isset($_SESSION[test]))
{
 echo $_SESSION[test];
}else
{
 echo No sessionvariable found..;
}
echo br.session_id().br;
On page two, there's always the 'no sessionvariable found...'-message, 
further the session id also changes... i dont understand what i am doing 
wrong...

_
Play online games with your friends with MSN Messenger 
http://messenger.msn.nl/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
_
MSN Search, for accurate results! http://search.msn.nl
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Bar codes in PHP

2003-07-28 Thread Brad Bonkoski


CPT John W. Holmes wrote:

 PHP wouldn't have anything to do with it. Your barcode should fill in a
 text area on a web page, which is the submitted to a PHP file for
 processing. You'll need something client site to get the code from the
 scanner to the web page.

You wouldn't really need a special program, just get a scanner that plugs into
the keyboard connection and click on the a text box and scan in, the scanner
will then fill in the ASCII representation of the bar code.  Or at least that is
one option...



 Unless you're talking about a program that acutally monitors the COM port
 that the scanner is plugged into on the server?

 ---John Holmes...

 - Original Message -
 From: Norma Ramirez - TECNOSOFT [EMAIL PROTECTED]
 To: lista php [EMAIL PROTECTED]
 Sent: Monday, July 28, 2003 3:19 PM
 Subject: [PHP-DB] Bar codes in PHP

 Hi all, does someone know how to capture or read bar codes from php? It will
 be great if I could do inputs to my database directly from bar codes in the
 products. Ideas???
 Thank´s
 Norma Ramirez
 Area de Desarrollo Web
 [EMAIL PROTECTED]

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] hi (php-SSH)

2003-07-28 Thread Brad Bonkoski
Well, SSH has a server which woudl answer your requests and a lient to
initiate the session, I'm assuming you wish to emulate the client side to
initiate the session, of course PHP is a server side language, so it's not
adding up.  I have seen a JAVA applet that will open in a web browser on the
client side to enable you to run an SSH client, perhaps this will server your
needs?  Try a google search.

-Brad

Suman Aluru wrote:

 hi ,
   is there any way to write a PHP program for SSH.
 I want to establish a SSH connection and work some commands in the remote
 system and close the connection.

 Thank You.

 --
 Suman R Aluru
 System Administrator
 Bacterial Barcodes Inc.
 8080 N.Stadium Dr.
 Houston TX-77054
 713.467.8500 (Off.)
 832.643.9501 (Cell)

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] un-encrypting passwords

2003-07-28 Thread Brad Bonkoski
Typically in these systems you do not send them their password un-encrypted if
they lose it because like you said, it is one way.  Normally, you collect
certain information to validate them, and then generate a new password to email
them, so they can get it and once again reset their password if they so choose,
or you could force them to.

-Brad

Sam Folk-Williams wrote:

 Hi,

 I've got a PHP/MySQL site that uses a simple user table to check for a valid
 username/password match when logging someone in. I encrypted the passwords
 using mysql's PASSWORD() function. I now realize that was probably not the
 best choice, because I don't think it's possible to un-encrypt them. I want
 to add a feature that allows users to request to have their password emailed
 to them.

 Can anyone recommend a better method for encypting passwords and how to
 unencrypt? (is there a function in PHP for this? Or a different MySQL
 function?)

 Thanks,

 Sam

 --
 Sam Folk-Williams
 Service Team Leader/Webmaster
 Rise, Inc -- Creative Partnerships South
 (952) 884 8330 (V);  (952) 884 8371 (F)
 www.rise.org

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] MD5()

2003-02-26 Thread Brad Bonkoski
md5() is a one-way encryption algorithm.  So once they are encrypted, you cannot 
decrypt them.  Just look at the md5() function on the php website.  It has what you 
need to do.  Of course if you eventually need these back
in the clear, then md5 would not be a solution.
-Brad

Chris Payne wrote:

 Hi there everyone,

 I have to store some CC details in a database which are inputted from a form, is 
 MD5() the best way to secure the data?  If so, how do I view MD5() data after it has 
 been inserted?  Any good MD5() tutorials out there?

 Thanks for your help :-)

 Regards

 Chris


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] mysql wildcard

2003-01-08 Thread Brad Bonkoski
Well, if that is your only condition, why not use:
'select * from offtime' as your query?

I believe the % as a wildcard is standard SQL, so I would *think* it should
work in mysql, have you tried it?

-Brad

Edward Peloke wrote:

 I have an query:

 select * from offtime where type='$type'

 then I just pass the type variable to the page.  Is there a wildcard in
 mysql like there is in sqlserver that I can use to grab all the records?
 such as select * from offtime where type='%' would grab all.

 Thanks,
 Eddie

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] newbee in PHP-MySQL- help in relational tables

2002-12-15 Thread Brad Bonkoski
I would say, that MYSQL is a relational database, thus implying that tables
would eb relational and this is a DB forum, so just shot, what's the problem?

Phanivas Vemuri wrote:

 hi,
 I need to knwo if anyone had worked on a php interface for relational tables
 in MySql. I have a problem , would be explaning the problem after anyone
 responds.
 Thankyou,
 Phani.

 _
 The new MSN 8: advanced junk mail protection and 2 months FREE*
 http://join.msn.com/?page=features/junkmail

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] little question from beginner

2002-12-14 Thread Brad Bonkoski
Well, I would look at 2 possible problems:
1). Submit is an HTML input type, and I would try to avoid using it as a
script variable just to make sure avoid confusion.
2). You may not have register_globals turn 'on' in your php.ini file.  So,
if the form method is POST, try: $_POST['submit'].  Or $_SERVER['submit']

HTH
-Brad

Hermanto Kurniawan wrote:

 Hi,
 I am having trouble with using PHP for submitting a form.

 I've defined all the inputs for the form. and the html for the button is
 like this :
 input type=submit name=submit value=send

 when I wanted to process the data of the form using :
 if($submit){
 ...//my script here
 }

 the browser tell the notice that variable submit isn't defined..

 why??? thanks for answering

 _
 The new MSN 8: advanced junk mail protection and 2 months FREE*
 http://join.msn.com/?page=features/junkmail

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] database update question

2002-11-15 Thread Brad Bonkoski
If you wish to update all of them, then just eliminate the id condition.

[EMAIL PROTECTED] wrote:

 I have a database with several hundred entries of file names that end with
 .pdf. I have converted
 all those docs to .zip, now I need to change all the entries in the
 database to .zip. I tried to use
 update table_name set col_name='%.zip' where col_name like '%.pdf'  id
 = '11'
 but of course that changed the file name for id 11 to %.zip. Is there a way
 to change all the
 entries from .pdf to .zip without writing an update statement for each
 individual row?

 --
 Chip Wiegand
 Computer Services
 Simrad, Inc
 www.simradusa.com
 [EMAIL PROTECTED]

 There is no reason anyone would want a computer in their home.
  --Ken Olson, president, chairman and founder of Digital Equipment
 Corporation, 1977
  (They why do I have 8? Somebody help me!)

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Next N Interface

2002-09-30 Thread Brad Bonkoski

I did something like this with a photo gallery I made.  The approach I took is
the execute a query, get the number of rows, and divide that number by how ever
many records I wanted on that page.  Then that would give me the number of total
pages I would have for my navigational links at the bottom.  Then I would pass a
page number from page to page and multiply this by the number of records which
would give me the first record to display from the same query.  Soem sample
code:  (I displayed 4 pictures/records per page)
$num_rows = mysql_num_rows($result);

//Check to see if any rows are present
if ($num_rows = 0)
{
echo centerh2No Pictures Available in this Album/h2/center;
exit(1);
}
$x = ($num_rows/4);
$y = intval($x);
if ($x  $y)
{
$num_pages= $y+1;
}
else
{
$num_pages= $x;
}
$curr_row = ($curr_page*4);

if ($DEBUG  0)
{
echo Curr_row is: $curr_rowbr;
}
mysql_data_seek($result, $curr_row);

HTH
-Brad

Lucas Novæ Matrix wrote:

 Hello,

 I am trying to create a next n interface through php4, using results from
 a mysql query. I did this in the past easily with ColdFusion, but this time
 it's a bit more complicated.

 What I need to do basicaly is to have only 5 results per page. The first
 page displays the 5 results and Next Page  at the bottom, the second
 page displays results 6 to 10 and displays  Previous Page | Next Page
  , up until the last page that displays only the previous page, and the
 last results (from 1 to 5).

 I don't necessarely need to have each page as a number at the bottom, just
 the previous and next links. All I need basically is to either get or output
 only 5 rows at a time, with only needing the $_GET['startrow'] variable.

 Can anyone help me? (or just throw me a link to an existing page/script)

 Thanks,
 Éric.

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Next N Interface

2002-09-30 Thread Brad Bonkoski

That would actually work for just getting a certain number of records from a
query, but you would have to execute another query to figure out the navigational
links he said he wants on the bottom...like google has,  1 2 3 4 5 .  So,
when I attacked it I figured one query is better then two even if it returns a
whole bunch of records in the result that you are not using for that page. How is
that for performance?  which would be better?  Or even, is there an alternative
way to figureing out how many records are in a database?  Always more then one
way to skin a cat.
-Brad

Mark Lee wrote:

 How about appending  LIMIT _GET[startrow],5 to the end of your query.

 The first parameter to LIMIT is the start position and the second is
 the number of rows to return.

 Does this help, or am I misunderstanding your question?

 Mark

 Lucas Novæ Matrix wrote:

 Hello,
 
 I am trying to create a next n interface through php4, using results from
 a mysql query. I did this in the past easily with ColdFusion, but this time
 it's a bit more complicated.
 
 What I need to do basicaly is to have only 5 results per page. The first
 page displays the 5 results and Next Page  at the bottom, the second
 page displays results 6 to 10 and displays  Previous Page | Next Page
 
  , up until the last page that displays only the previous page, and the
 
 last results (from 1 to 5).
 
 I don't necessarely need to have each page as a number at the bottom, just
 the previous and next links. All I need basically is to either get or output
 only 5 rows at a time, with only needing the $_GET['startrow'] variable.
 
 Can anyone help me? (or just throw me a link to an existing page/script)
 
 Thanks,
 Éric.
 
 
 

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Flush database

2002-09-27 Thread Brad Bonkoski

How about writting the IP address to the database with a timestamp,
then when a matching IP address arrives you view the timestamp and if it has
been more then a hour, they can view the page, which would force you to
update the timestamp.  Of course you would probably need to write a
stand-alone (i.e. non-web) php script that would act as a cron job to clean
out the database periodically, whatever period you define (depending on
traffic and size of DB).

-Brad
wade wrote:

 I am storing IP addresses in a database, but after an hour has passed I
 want to delete all the IP addresses from that database. I want to do
 this based on the server time. Example.. Someone comes to my web page, I
 store their IP address in my database. So now I write a PHP script that
 says if that IP returns to my page within an hour, they can't view my
 page. If they come back after an hour has passed they can view the
 contents of that page. but only after an hour has passed.

 Can anyone help me with the syntax or functions that will clear the
 database after an hour of waiting has passed?
 Is this possible? Any suggestions, logic or any help on this matter will
 be greatly appreciated.

 Thank you

 --
 Should you have any questions, comments or concerns, feel free to call
 me at 318-338-2033.

 Thank you for your time,

 Wade Kelley, Design Engineer
 
 Bayou Internet...(888) 30-BAYOU...http://www.bayou.com
 Mississippi Internet...(800) MISSISSIPPI...http://www.mississippi.net
 Vicksburg Online...(800) MISSISSIPPI...http://www.vicksburg.com
 

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Flush database

2002-09-27 Thread Brad Bonkoski

Sounds like we are all on similar pages with timestamping, but if you issue a
delete query every time the page is viewed it could create some sub-par
performance based on number of hits.  i.e. if the site gets 100 hits in the
first 10 minutes of operation, it would issue delete logic and queries 100
times, but since they are all *new* the logic would not really do anything,
right?  So, depening on what kind of traffic you plan to generate a cron job may
be your best bet, if you plan to generate a whoel bunch, you may even need to
kick it off every hour.

-or- you could use this logic, but store in a different table a timestamp for
last delete and every time view that timestamp, and if more then a hour has
passed, then go ahead with your database clean-up routine.

-Brad


Jim Hunter wrote:

 First make sure that you are storing the IP and the time it was saved in the
 database.

 Then I would have 3 queries:

 1) a query to see if the IP address is in the database and less then an hour
 old.

 2) a query to save the IP and time into the database

 3) a query to delete all entries over 1 hour old.

 Then when you get a new visitor see if the IP address is in the database and
 is not less then 1 hour old. Once it clears that test, save the IP and time,
 then always run the delete query to clear out entries. If you have a lot of
 traffic to your site you are going to generate a lot of database hits.

 Good luck.

 Jim



 ---Original Message---



 From: wade

 Date: Friday, September 27, 2002 02:02:50 PM

 To: [EMAIL PROTECTED]

 Subject: [PHP-DB] Flush database



 I am storing IP addresses in a database, but after an hour has passed I

 want to delete all the IP addresses from that database. I want to do

 this based on the server time. Example.. Someone comes to my web page, I

 store their IP address in my database. So now I write a PHP script that

 says if that IP returns to my page within an hour, they can't view my

 page. If they come back after an hour has passed they can view the

 contents of that page. but only after an hour has passed.

 Can anyone help me with the syntax or functions that will clear the

 database after an hour of waiting has passed?

 Is this possible? Any suggestions, logic or any help on this matter will

 be greatly appreciated.

 Thank you

 --

 Should you have any questions, comments or concerns, feel free to call

 me at 318-338-2033.

 Thank you for your time,

 Wade Kelley, Design Engineer

 

 Bayou Internet...(888) 30-BAYOU...http://www.bayou.com

 Mississippi Internet...(800) MISSISSIPPI...http://www.mississippi.net

 Vicksburg Online...(800) MISSISSIPPI...http://www.vicksburg.com

 

 --

 PHP Database Mailing List (http://www.php.net/)

 To unsubscribe, visit: http://www.php.net/unsub.php

 .


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Current row of query

2002-09-26 Thread Brad Bonkoski

oops...

I meant:
(if $i is odd)
...

because $i would be the current index in the array.


Brad Bonkoski wrote:

 why not this?

 $result = mysql_query(Select * from table');
 $num_rows = mysql_num_rows($rows);

 for ($i=0; $i$num_rows, $i++)
 {
 $row = mysql_fetch_array($result);
 if ($num_rows is odd)
 {
 print $row with BG color of red;
 }
 else
 {
 printf $row with BG color of purple;
 }
 }

 HTH
 -Brad

 Patrick Lebon wrote:

  Is there a mysql or array variable for the current row of a query array?
  I want to alternate background colours for each row of the query output so i
  need to know the current row number.
 
  Thanks
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Current row of query

2002-09-26 Thread Brad Bonkoski

then add an extra conditional to check if $i is equal to 0, or start $ off as
1so,
for ($i=1, $i$num_rows+1; $i++)
-or-
if ($i==0)
//treat as even

either way woudl work.
-Brad

Hutchins, Richard wrote:

 Not sure here, but you might also run into a problem if you start your if
 statement with $i=0. If PHP does not treat the value 0 as even or odd, your
 first row is most likely going to be purple along with your second row. I
 know it's nitpicky, but I could see myself spending half an hour trying to
 figure out why the code works, but not the way I want it to.

  -Original Message-
  From: Brad Bonkoski [mailto:[EMAIL PROTECTED]]
  Sent: Thursday, September 26, 2002 11:10 AM
  To: Patrick Lebon; [EMAIL PROTECTED]
  Subject: Re: [PHP-DB] Current row of query
 
 
  oops...
 
  I meant:
  (if $i is odd)
  ...
 
  because $i would be the current index in the array.
 
 
  Brad Bonkoski wrote:
 
   why not this?
  
   $result = mysql_query(Select * from table');
   $num_rows = mysql_num_rows($rows);
  
   for ($i=0; $i$num_rows, $i++)
   {
   $row = mysql_fetch_array($result);
   if ($num_rows is odd)
   {
   print $row with BG color of red;
   }
   else
   {
   printf $row with BG color of purple;
   }
   }
  
   HTH
   -Brad
  
   Patrick Lebon wrote:
  
Is there a mysql or array variable for the current row of
  a query array?
I want to alternate background colours for each row of
  the query output so i
need to know the current row number.
   
Thanks
   
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
  
   --
   PHP Database Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
 
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Current row of query

2002-09-26 Thread Brad Bonkoski

Last I checked there was no way to retrieve the current index into the result
array, you can set the index manually with mysql_seek_data(), but I don't think
that is what you want, so the best solution IMHO, is to do what you are doing
and manually keep track of the index.
-Brad

Patrick Lebon wrote:

 Thanks, im currently doing something similar to this but I was wondering if
 there was an already defined variable that i could use rather then have to
 create a value and increment it myself. I guess am being picky, but was just
 curious as im new to php.

 This is how im currently doing it...

  $rowNum = 0;
  while ( $row = mysql_fetch_array($result) )
  {
  $rowNum++;
  if ($rowNum % 2) { $bgCol = #EADBC6; } else { $bgCol = #EFE1CE; }
 echo ..;
 }

 Brad Bonkoski [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  why not this?
 
  $result = mysql_query(Select * from table');
  $num_rows = mysql_num_rows($rows);
 
  for ($i=0; $i$num_rows, $i++)
  {
  $row = mysql_fetch_array($result);
  if ($num_rows is odd)
  {
  print $row with BG color of red;
  }
  else
  {
  printf $row with BG color of purple;
  }
  }
 
  HTH
  -Brad
 
  Patrick Lebon wrote:
 
   Is there a mysql or array variable for the current row of a query array?
   I want to alternate background colours for each row of the query output
 so i
   need to know the current row number.
  
   Thanks
  
   --
   PHP Database Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
 

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] SQL file,

2002-09-21 Thread Brad Bonkoski

Typically, it is a text file that has SQL in it.
Like:
CREATE DATABASE some_name (
ID int NOT NULL AUTO_INCREMENT PRIMARY KEY,
NAME varchar(30),
etc

Usually they are used to store the database information, and can be used in many of 
the database systems.  Within the database itself, there is a command to insert from a 
file.  Not sure off the top of my head, but the help menu should provide that
information, then the database would go through your file and execute those commands 
as if you were entering them in manually on the command line.  Espescially helpful for 
huge tables where you might be open to a typo, and have to start all over.
HTH
-Brad

Bryan McLemore wrote:

 in an example I saw in a book while I was leafing through it at barnes and nobles I 
saw a .sql file.  It appeared to have the schema for a db in it.  I was wondering 
what exactly what it is and how one could use it in a php application like he was 
doing.

 Thanks,
 Bryan


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] SQL file,

2002-09-21 Thread Brad Bonkoski

I don't think it quite works that way through PHP.  You could send the
_contents_ of the file through PHP, like open the file, and read it into a
buffer, and send that as a query.  I actually create the files and then go into
my database system (MySQL -or- PostgreSQL) and then execute a command.  I think
for MySQL it is:
mysql \i name_of_file
and then that will step through the file executing the SQL statements.
-Brad

Bryan McLemore wrote:

 So I would send the file through with a sql query?

 -Bryan
 - Original Message -
 From: Brad Bonkoski [EMAIL PROTECTED]
 To: Bryan McLemore [EMAIL PROTECTED]
 Cc: PHP DB LIST [EMAIL PROTECTED]
 Sent: Saturday, September 21, 2002 8:18 AM
 Subject: Re: [PHP-DB] SQL file,

  Typically, it is a text file that has SQL in it.
  Like:
  CREATE DATABASE some_name (
  ID int NOT NULL AUTO_INCREMENT PRIMARY KEY,
  NAME varchar(30),
  etc
 
  Usually they are used to store the database information, and can be used
 in many of the database systems.  Within the database itself, there is a
 command to insert from a file.  Not sure off the top of my head, but the
 help menu should provide that
  information, then the database would go through your file and execute
 those commands as if you were entering them in manually on the command line.
 Espescially helpful for huge tables where you might be open to a typo, and
 have to start all over.
  HTH
  -Brad
 
  Bryan McLemore wrote:
 
   in an example I saw in a book while I was leafing through it at barnes
 and nobles I saw a .sql file.  It appeared to have the schema for a db in
 it.  I was wondering what exactly what it is and how one could use it in a
 php application like he was doing.
  
   Thanks,
   Bryan
 
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] Re: PhpMyAdmin's File Manager and apps

2002-09-11 Thread Brad Bonkoski

http://sourceforge.net/projects/phpmyadmin/

Russell Griechen wrote:
 
 Where are the downloads for these apps?
 
 Russell Griechen

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] PHP Editor?

2002-09-06 Thread Brad Bonkoski

1). vi (The best editor for any language, IMHO)
2). Yes

Bryan McLemore wrote:
 First off, What html/php editor do you guys think is better?
 
 Secondly, perhaps a little more relevant to the database part of this.  I just want 
to clarify that with mysql_query() I can send any valid sql expression and it will do 
that?
 
 -Bryan
 



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Table formatting a link from a mysql query result

2002-09-05 Thread Brad Bonkoski

$variable_to_be_passed = 'some value';
echo tda href='some_page.php?variable=$variable_to_be_passed'I am a 
link/a/td;

I think this should do it, not quite sure what you mean by wrappinga 
table cell in a anchor tag?  Of course if you need to use the results of 
a database, this can be done too with the same method.

HTH
-Brad

Aaron Merrick wrote:
 All,
 
 How can I display the results of a table so that the first field (column) is
 a link to another page that shows the details of that row? Issue #1, I have
 to wrap the cell contents in an a href.  Issue #2, I need to pass a
 variable to the referenced page when the link is clicked.  Anyone know of
 any good examples of this?
 
 Thanks,
 Aaron
 
 



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] database result: tables with 2 coloumns

2002-09-05 Thread Brad Bonkoski

How's this? (MYSQL example)

$query = select NAME from table_name;
$result = mysql_query($query)
or die(Invalid Query: $query);

$num_rows = mysql_num_rows($result);
$counter=1;
echo table border=1tr; //start of table
for ($i=0;$i$num_rows; $i++) //loop through the number of records
{
$row = mysql_fetch_array($result); //Get associate row
echo td$row[0]/td;  //Print out the NAME
if ($counter == 2)
{
echo /trtr; //Make a new Table row
$counter=1;   //Reset Counter   
}
else
{
$counter++; //Just increment the counter
}
}
echo /tr/table;
mysql_free_result($result);

HTH

-Brad

[EMAIL PROTECTED] wrote:
 Hi..
 
 I'm creating a database result in a table, but I need to put it into 2
 columns of looping row like this:
 
 |name1|name2|
 |name3|name4|
 |name5|name6|
 |name7|name8|
 |name9|name10  |
 etc...
 
 can anyone help me please...
 
 iman
 
 
 



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php