Re: [PHP-DB] Auto increament

2004-06-27 Thread Daniel Clark
Yes there is an auto increment field in mySQL and most other databases.

>>Can any of you guide me how to do auto increament in a field?
>>I think there is one datatype for auto increament.
>>But I dont know how to do it ?
>> 
>>Rinku

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



Re: [PHP-DB] Date help needed

2004-06-24 Thread Daniel Clark
A drop down with 365 days !?!?   Isn't that a "little" big?

> I have a problem, I currently have some code which populates a dropdown
> box
> - this code gives me every day for the next x amount of days (EG: a years
> worth of days), however what I really need to be able to do, is to find a
> way to display this data in the dropdown box but ONLY show 3 days a week,
> IE: Mondays, Fridays and Sundays, so it would show the dates for each
> Monday, Friday and Sunday for X amount of days (IE: 365 days in the
> dropdown).
>
>
>
> Does anyone have any idea how to do this?  I would really appreciate any
> help, I'd send my sample code only I'm not at my home/work computer ATM.

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



Re: [PHP-DB] [PHP]: session problem

2004-06-24 Thread Daniel Clark
What are you setting $_SESSION['sid'] to?


> i do ($_SESSION['sid']), but the variables remain empty...

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



Re: [PHP-DB] [PHP]: session problem

2004-06-24 Thread Daniel Clark
Are you getting any errors displayed?

The php.ini file has to have a directory specified for the session temp
variables.

> I want to use sessions to check wether a user is logged in or not.
> Therefore,I use session_start and session_register. When I registere the
> values on the same page, they all seem to work. But when I ask the value
> of
> a registered session variable on another page, it is empty?!?! Does anyone
> know how this comes? i am using session_start() at every page..
>
> i believe it must be in my php.ini setting because on my hosting provider
> it
> does work all correctly.. can anyone helpme?

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



Re: [PHP-DB] problem....

2004-06-22 Thread Daniel Clark
Sounds like it doesn't like your SQL statement.  Perhaps a field or table
name is incorrect?

> Warning: mysql_fetch_array(): supplied argument is not a valid MySQL
> result
> resource in .......
> "Daniel Clark" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>> What error are you getting?
>>
>> > why doesn't this work:
>> > $pic=mysql_query('SELECT Rune, username FROM RuneRunner
>> > RuneRunner_1 WHERE (User_ID = 3)',$connection);
>> > $pic=mysql_fetch_array($pic);

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



Re: [PHP-DB] problem....

2004-06-22 Thread Daniel Clark
What error are you getting?

> why doesn't this work:
> $pic=mysql_query('SELECT Rune, username FROM RuneRunner
> RuneRunner_1 WHERE (User_ID = 3)',$connection);
> $pic=mysql_fetch_array($pic);

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



Re: [PHP-DB] Multiple Inserts

2004-06-22 Thread Daniel Clark
Good point.  Since it's form data, what about $_POST['TimesheetID'] ?

> Don't see anything obviously wrong with your query string. Are the inserts
> happening in the same block of code, i.e., are you sure that
> _$TimesheetID_ has a value in it when you're performing the second insert?
>
>
> -dave
>
>
>> I am using a form to Insert data into 2 tables in the same database.
>
>> $TimesheetID needs to be in each table. However, it is not being
> inserted
>> into the second table, "tblTimesheetDetails" . Any advise?
>
>> $result_timesheet=mysql_query("INSERT INTO tblTimesheet (TimesheetID,
>> WorkerID, ClientID, TimesheetDate, ProspectiveOrRetrospective) VALUES
>>
> ('$TimeSheetID','$WorkerID','$ClientID','$TimesheetDate','$ProspectiveOrRetr
>> ospective')")or die("Insert Error: ".mysql_error());
>
>> $result_timesheetdetails=mysql_query("INSERT INTO tblTimesheetDetails
>> (TimesheetID, ActivityTypeID, TimeSpentHours, TimeSpentMinutes) VALUES
>>
> ('$TimeSheetID','$ActivityTypeID','$TimeSpentHours','$TimeSpentMinutes')")or
>> die("Insert Error: ".mysql_error());
>

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



Re: [PHP-DB] Multiple Inserts

2004-06-22 Thread Daniel Clark
Any errors?   Is the all the other data inserting into the second table?

> Hello,
> I am using a form to Insert data into 2 tables in the same database.
>
> $TimesheetID needs to be in each table. However, it is not being inserted
> into the second table, "tblTimesheetDetails" . Any advise?
>
> $result_timesheet=mysql_query("INSERT INTO tblTimesheet (TimesheetID,
> WorkerID, ClientID, TimesheetDate, ProspectiveOrRetrospective) VALUES
> ('$TimeSheetID','$WorkerID','$ClientID','$TimesheetDate','$ProspectiveOrRetr
> ospective')")or die("Insert Error: ".mysql_error());
>
> $result_timesheetdetails=mysql_query("INSERT INTO tblTimesheetDetails
> (TimesheetID, ActivityTypeID, TimeSpentHours, TimeSpentMinutes) VALUES
> ('$TimeSheetID','$ActivityTypeID','$TimeSpentHours','$TimeSpentMinutes')")or
> die("Insert Error: ".mysql_error());
>
>
> Thanks,
> Declan.

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



Re: [PHP-DB] anonymous select error

2004-06-15 Thread Daniel Clark
I'm not sure you need a semi-colon after the table name.

$result = mysql_query( 'Select * From newsletter_subscribers', $db );

>>
>>To: [EMAIL PROTECTED]
>>MIME-Version: 1.0
>>Content-Type: text/plain; charset=us-ascii
>>
>>I'm trying this query:
>>
>>$link = mysql_connect( $site, $id, $pass );
>>if (!$link) {
>>   die('Could not connect: ' . mysql_error());
>>}
>>echo 'Connected successfully';
>>
>>$db = mysql_select_db( $dbname, $link);
>>if( !$db ) {
>>   echo "DB false";
>>   exit;
>>}
>>
>>$result = mysql_query( 'Select * From
>>newsletter_subscribers;', $db );
>>
>>if (!$result) {
>>   echo "DB Error, could not list tables";
>>   echo 'MySQL Error: ' . mysql_error();
>>   exit;
>>}
>>
>>
>>with this output:
>>
>>Connected successfully
>>DB Error, could not list tables
>>MySQL Error:
>>
>>I dont understand why there is an error, but it prints
>>nothing for the error.  Any ideas?  Thanks, Josh




Re: [PHP-DB] About retrieving auto increment value

2004-06-07 Thread Daniel Clark
I think you want mysql_insert_id()

http://us3.php.net/manual/en/function.mysql-insert-id.php


> I have the typical problem with retrieving auto increment value in
> php-mysql environment.
>
> I have search info in mysql page and I have found LAST_INSERT_ID()
> funtion but I don't know how to use correctly.
>
> I have one script that insert a row. And another script that must
> retrieve last auto_increment value for primary key on a table.
>
> I want something like this:
>
> SELECT LAST_INSERT_ID() FROM foo_table; (like curval(foo_sequence) in
> postgres)
>
> This doesn't work.
>
> It's possible? Where I am wrong?
>
> Thanks in advance
> --
> Marc Soler

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



Re: [PHP-DB] strange results in mysql with readdir.php

2004-06-06 Thread Daniel Clark
I'd think there where multiple files with jpg and gif extensions.

Like:

image1.jpg
image1.jpg.jpg


>>Anybody has an idea about what happened to me ? 
>>
>>The following script should just charge in a mysql db the images located in
>>a directory. Unfortunately everytime I call "readdir.php" (never mind if
>>there are or not new images) mysql is charging 2 or 6 copies of the same
>>last image uploaded into the directory. Anybody may explain to me where I'm
>>failing?
>>  Thanks for all the phpers!
>>  Alessandro
>>
>>>$dbcnx = mysql_connect("localhost", "root", "password"); 
>>mysql_select_db("news");
>>
>>if (!$dbcnx) 
>>{ 
>>echo( "connection to database server failed!");
>>exit();
>>} 
>>
>>if (! @mysql_select_db("news") )
>>{ 
>>echo( "Image Database Not Available!" ); 
>>exit(); 
>>}
>>
>>$path = "./";
>>$dir_handle = @opendir($path) or die("Unable to open directory $path");
>>
>>while ($file = readdir($dir_handle)) {
>>$filetyp = substr($file, -3);
>>if ($filetyp == 'gif' OR $filetyp == 'jpg') {
>>$handle = fopen($path . "/" . $file,'r');
>>$file_content = fread($handle,filesize($path . "/" . $file));
>>fclose($handle);
>>
>>$encoded = chunk_split(base64_encode($file_content)); 
>>$sql = "INSERT INTO images SET sixfourdata='$encoded'"; 
>>
>>@mysql_query($sql);
>>}
>>}
>>closedir($dir_handle);
>>echo("complete");
>>?>

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



Re: [PHP-DB] Error loading module: "Unable to load dynamic library 'c:\tools\php\extensions\php_oci8.dll' - The specified procedure could not be found

2004-06-05 Thread Daniel Clark
Another person had the same problem, found this.

http://forums.devshed.com/archive/t-23692

They suggested:

Try setting the extension dir to C:/WINNT/SYSTEM or
where your dll-files resides 


>>Yes, and as I was writing earlier, the message talks about a missing 
>>procedure. If I remove the file temporarily, the message talks about a 
>>missing library. So I think it can find the file OK, but that this 
>>php_oci8.dll file is the wrong version or that it is looking for an 
>>additional DLL that it can't find OR that it can find the additional DLL 
>>but it is the wrong version. If I only knew what DLL was needed!
>>
>>Daniel Clark wrote:
>>> Is the file in c:\tools\php\extensions\php_oci8.dll ?
>>> 
>>> 
>>>>>Hi,
>>>>>I am experiencing the message in the title of this message when starting 
>>>>>or restarting Apache. I have the following configuration:
>>>>>
>>>>>- Windows XP
>>>>>- Apache 2.0.49
>>>>>- PHP 4.3.6
>>>>>- Oracle Client 8i
>>>>>
>>>>>If anyone has any information as to why this is happening and how I can 
>>>>>solve it, I would be very grateful. Thanks.
>>

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



Re: [PHP-DB] Error loading module: "Unable to load dynamic library 'c:\tools\php\extensions\php_oci8.dll' - The specified procedure could not be found

2004-06-04 Thread Daniel Clark
Is the file in c:\tools\php\extensions\php_oci8.dll ?

>>Hi,
>>I am experiencing the message in the title of this message when starting 
>>or restarting Apache. I have the following configuration:
>>
>>- Windows XP
>>- Apache 2.0.49
>>- PHP 4.3.6
>>- Oracle Client 8i
>>
>>If anyone has any information as to why this is happening and how I can 
>>solve it, I would be very grateful. Thanks.
>>
>>-- 
>>PHP Database Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>>




Re: [PHP-DB] Multiple SQL queries...?

2004-06-03 Thread Daniel Clark
Not tested... how about something like this?

SELECT t1.email, t2.count(*)
FROM $table t1
LEFT JOIN $table t2 ON (t1.email = t2.email and t2.viewed = '1')
GROUP BY EMAIL


> Nope...
> HHmmm, this is really getting to me...
> I can do distinct, I can count, but I can't combine the two?
> Can't be that hard ;-)

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



Re: [PHP-DB] Multiple SQL queries...?

2004-06-03 Thread Daniel Clark
OK, how about this?

$sql = "SELECT DISTINCT(email) FROM $table";
$result = mysql_query($sql,$connection) or die("Couldn't execute query
0.");


while ($row = mysql_fetch_array($result)) {

 echo $row[email] ;


 $sql1 = "SELECT * FROM $table WHERE viewed = '1' AND email =
'$row[email]'";
 $result1 = mysql_query($sql1,$connection)   or die("Couldn't execute
query 1.");

 echo ' ' . mysql_num_rows($result1) ;
}

echo $row1 ;

> Kinda, but I just wanna count how many views in total...
> Hence my $row1++; bit...
> I'll have a play with your code though...!
> Cheers,
> Tris...

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



Re: [PHP-DB] Multiple SQL queries...?

2004-06-03 Thread Daniel Clark
Is this what you want ??

$sql = "SELECT DISTINCT(email) FROM $table";
$result = mysql_query($sql,$connection) or die("Couldn't execute query 0.");

$row1 = 0;


while ($row = mysql_fetch_array($result)) {

echo $row[email] ;

$sql1 = "SELECT * FROM $table WHERE viewed = '1' AND email = '$row[email]'";
$result1 = mysql_query($sql1,$connection)   or die("Couldn't execute query 
1.");

if (mysql_num_rows($result1) >= 1) {
echo 'Viewed' ;
} else {
echo '' ;
}
}

echo $row1 ;

>>Right, todays fun dilema... ;-)
>>I've a user capture system set up for downloads on our site.
>>Each time a user downloads a file, their info is captured (so we'll have 
>>multiple entries for each email address).
>>Also in the table, is a field to state if the result has been viewed by my 
>>boss. (Just a 1/0 value)
>>
>>So, what my boss wants me to do now, is to show her, the total No of 
>>people captured, and how many she's viewed.
>>Using the 'email' field, from the table, I've done a distinct() sort in 
>>MySQL to ensure that I have a list of emails(users) and no duplicates.
>>My prob is this:
>>I want to take each email, and see if at any point, there's a '1' in the 
>>viewed field.
>>if there is, I want to add one to the total of $row1
>>So I can output the num_rows from the distinct request, and then show the 
>>total of $row1...
>>So I'll have total No of users, and total No of viewed... as I've 
>>mentioned above.
>>What am I doing wrong?
>>
>>>$sql = "SELECT DISTINCT(email) FROM $table";
>>$result = mysql_query($sql,$connection)
>>or die("Couldn't execute query 0.");
>>
>>$row1 = 0;
>>
>>while ($row = mysql_fetch_array($result)) {
>>
>>$sql1 = "SELECT * FROM $table WHERE viewed = '1' AND email = 
>>'$row[email]'";
>>$result1 = mysql_query($sql1,$connection)
>>or die("Couldn't execute query 1.");
>>if (mysql_num_rows($result1) >= 1) {
>>$row1++;
>>}
>>}
>>?>
>>

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



Re: [PHP-DB] Re: big/small letters with oracle No2

2004-06-03 Thread Daniel Clark
I've used Oracle for years, and am not aware of Oracle having case sensitive column 
names.


>"Torsten Lange" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
>>
>> But when using queries on the USER_... data dictionary, Oracle
>> delivers always big letters, which is for chemical elements (NA
>> vs. Na) or location names (ALICE SPRINGS vs.  Alice Springs) and
>> location codes often uncomfortable to read.
>>
>>> Then I see only one way: create a mapping array to map your field names to
>>> what you want them to be *really* called.
>>> 
>>> $mapping = array('FIELD1' => 'My real field name', 'FIELD2' => 'My second
>>> field name');
>>> 
>>> Then you get the value this way:
>>> 
>>> $realName = $mapping[$fieldNameFromDB];
>>
>>A mapping is the best way.  It separates the internal schema structure
>>(i.e column names as created by Oracle) from the display values (i.e.
>>the column names you want to display).
>>
>>But it is possible to get PHP to return case sensitive column names from
>>Oracle, see below.
>>
>>Chris
>>
>>-
>>
>> >
>> // Example using case sensitive column names in Oracle.
>> //
>> // Table P1 was created in SQL*Plus using:
>> //
>> //create table p1 ("MyCol" number);
>> //insert into p1 values (1234);
>> //commit;
>> //
>> // The output of this PHP script is:
>> //
>> //   array(1) {
>> // ["MyCol"]=>
>> // string(4) "1234"
>> //   }
>>
>> $conn = OCILogon("scott", "tiger", "MYDB");
>>
>> $query = 'select * from p1';
>>
>> $stid = OCIParse($conn, $query);
>> OCIExecute($stid);
>> OCIFetchInto($stid, $row, OCI_ASSOC);
>> echo ""; var_dump($row); echo "";
>>
>> OCILogoff($conn);
>>
>> ?>
>>
>>-- 
>>Christopher Jones, Oracle Corporation, Australia.




Re: [PHP-DB] Question about undices for inversed LIKE statesments.

2004-05-31 Thread Daniel Clark
The index should still work normally.

>>Hello.
>>I have a question about behaviour of indices in queries with inversed LIKE
>>in MySQL. I mean something like this:
>>
>>"select foo from bar where '$some_string' LIKE some_field"
>>
>>where in the `some_field` I have a strings like 'symbols%' :)
>>
>>Do you have some ideas?
>>
>>WBR, Wicked

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



Re: [PHP-DB] "Where" Error

2004-05-29 Thread Daniel Clark
SELECT ..
WHERE status IN ('i', 'c', 'o') ;
ORDER BY $sort_field $sort_order";


>>$get_data_query = "select state, cd, representative, status, party, 
>>netreceipts,
>>individualcontributions, paccommcontributions, candidatesupport, 
>>netdisbursements
>> from fec33104
>>
>>where status = i
>>
>>order by $sort_field $sort_order";
>>
>>**
>>On Sat, 29 May 2004 07:50:52 -0700, Daniel Clark <[EMAIL PROTECTED]> wrote:
>>
>>> Can you post the code?
>>>
>>> Something like:
>>>
>>> WHERE status IN ('i', 'c', 'o') ;
>>>
>>>
>>>>> This should be ultimately simple; it just doesn't work.  I want to 
>>>>> limit
>>>>> display to rows from a single table in which the status column contains
>>>>> i.  Only options are i, c, o.  After the select line I have "where 
>>>>> status
>>>>> = i"  (no quote marks).  I get an error message to the "while" line 
>>>>> that
>>>>> calls the table.
>>>>>
>>>>> When I limit by another column "where netreceipts > 500" I get the 
>>>>> desired
>>>>> result.  When I change it to "where netreceipts = 500" (and there is a
>>>>> 500) I get the error message above.
>>>>>
>>>>> What's the solution?
>>>>>
>>>>> Ken
>>>
>>>
>>>
>>
>>
>>




Re: [PHP-DB] "Where" Error

2004-05-29 Thread Daniel Clark
Can you post the code?

Something like:

WHERE status IN ('i', 'c', 'o') ;


>>This should be ultimately simple; it just doesn't work.  I want to limit 
>>display to rows from a single table in which the status column contains 
>>i.  Only options are i, c, o.  After the select line I have "where status 
>>= i"  (no quote marks).  I get an error message to the "while" line that 
>>calls the table.
>>
>>When I limit by another column "where netreceipts > 500" I get the desired 
>>result.  When I change it to "where netreceipts = 500" (and there is a 
>>500) I get the error message above.
>>
>>What's the solution?
>>
>>Ken  

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



Re: [PHP-DB] Undefined variable

2004-05-26 Thread Daniel Clark
Are you using a FORM Post or Get ?

Perhaps $_POST['Name']  or $_GET['Name']

>>Hi!!
>> 
>>I have a very simple and smail script with just one input text box and a
>>submit button.
>>After that, I have an echo function in the same code page that just
>>displays the data entered in the text box.
>> 
>>But I'm receiving an undefinied variable error when I execute it!!
>> 
>>Echo ($Name);
>> 
>>I'm using Windows 2000 Server and PHP for Windows.
>> 
>>Regards,
>> 
>>Miguel Guirao
>>Servicios Datacard
>>www.SIASA.com.mx
>> 
>>




Re: [PHP-DB] Select news based on dates

2004-05-17 Thread Daniel Clark
ORDER BY date, text ?

> Hi!
> You can use "order by date" and such method:
> 
> $result = mysql_query(blablabla);
> $date = "foo";
> while($news = mysql_fetch_array($result)){
> if ($date==$news["date"]){
> echo "new date";
> }
> echo $news["text"];
> $date = $news["date"];
> }
>
>
> Monday, May 17, 2004, 3:50:04 PM, T. wrote:
>
> THG> Hello,
>
> THG> I would like to display my news like this:
>
> THG> *10.04.2004.*
> THG> - news 1
> THG> - news 2
> THG> - news 3
> THG> *14.04.2004.*
> THG> - news 4
> THG> *15.04.2004.*
> THG> - news 5
> THG> ...

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



Re: [PHP-DB] inserting data into database!

2004-05-14 Thread Daniel Clark
$tmp isn't defined yet, so can't append to it's self.
(no .= )

$tmp = "ID   : $row->ID   \n";


> Two questions?
> First why am I getting  undefined variable tmp , yet it works
> Second how would I insert data into this table?
>  $db_table = 'log';
> $conn = mysql_connect($db_host,$db_user,$db_pass);
>
> if ($conn == true) {
>   mysql_select_db($db_name,$conn);
>   $result = mysql_query("SELECT * from $db_table",$conn);
> while($row = mysql_fetch_object($result)) {
> $tmp .= "ID   : $row->ID   \n";
> $tmp .= "Base : $row->Base \n";
> $tmp .= "Date_and_Time  : $row->Date_and_Time   \n";
> $tmp .= "Event_Type : $row->Event_Type \n";
> $tmp .= "Description : $row->Description \n";
> $tmp .= "Initials : $row->Initials \n";
> }
> } else {
> echo 'could not connect to database : '. mysql_error();
> }
> print $tmp;
> ?>

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



Re: [PHP-DB] Newbie inserting into a database

2004-05-14 Thread Daniel Clark
Remove the single quotes or change to double quotes around the variables.
(in the mysql_connect() statement)


> Here is what I have so far?
>  $DBname = "testdatabase";
> $host="localhost";
> $user="root";
> $password = "password";
>
>
> $dbconnect = @mysql_connect('$host','$user','$password','$DBname');
>
> I know this is wrong since I am not connecting.
>
> What I want to do is INSERT several values into a database.  What am I
> doing
> wrong and what do I need to do after I connect (The Code)?  7 day old
> problem here and pulling at my hair!  Appreciate it!

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



Re: [PHP-DB] Newbie inserting into a database

2004-05-14 Thread Daniel Clark
Remove the single quotes or change to double quotes around the variables.

> Here is what I have so far?
>  $DBname = "testdatabase";
> $host="localhost";
> $user="root";
> $password = "password";
>
>
> $dbconnect = @mysql_connect('$host','$user','$password','$DBname');
>
> I know this is wrong since I am not connecting.
>
> What I want to do is INSERT several values into a database.  What am I
> doing
> wrong and what do I need to do after I connect (The Code)?  7 day old
> problem here and pulling at my hair!  Appreciate it!

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



Re: [PHP-DB] Serious Problem: Eval'ing conditioned blocks!

2004-05-10 Thread Daniel Clark
I had something like this too.
I used something other for the start and ending blocks.
<#  #>
Then had a replace() section.

> Hi there,
> I (still :-) ) have the code of my php pages stored in a database. A main
> page parses this code using the "eval_html" function postet at php.net.
> This
> used to work fine, but then I tried to employ conditioned blocks, e.g.
> 
>   Hello World
> 
>
> The function I use seperates this code in three parts (1st:  { ?>) and tries to eval every single one. This of course causes an error
> because neither "while (foo) {" nor "}" is valid statement.
> Anybody knows a workaround (that doesn't mean putting all HTML output in
> PHP
> "echo" commands) ??
> 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



Re: [PHP-DB] Need some HELP (not works)

2004-05-10 Thread Daniel Clark
Is it User_name or UserName?

Also try this string with 'UserName' in single quotes.

print ""; 

> I've tried but still does not work.
> when I put the varaibles name between ' '
>
> I found this error:
> Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or
> `T_NUM_STRING'.
>
> I typed in this way
>
>  print " VALUE='$_POST[UserName]'>"; 
>
> but nothing  a new.
>
> I have checked  "register_globals" is on.
> in my first page I used session_start(); and   global $HTTP_SESSION_VARS;
> I dont know if this cause the problem that I had.
>
> Thanks again and more help please.
> Adam

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



Re: [PHP-DB] Need some HELP

2004-05-10 Thread Daniel Clark
unless you have Globals turned on, I think you and
$_POST['variable_name_here'] in the second page.


print "\n";


> Hi,
>
> I am  a new to php. I am using php ver 4.0.3 and MySQL.
>
> I have wrote two files and I'd like to pass some varaibles from first file
> to use them in the second file.
> but  the values did not displayed in the second file(nothing print out).
> and
> also I want to pass them to anothr file ...  here is what I've wrote :
>
>  file1.php**
>  .
> $username="A";
> $user_num="123";
> $user_addres="User Address";
>
> print "";
>   print "";
> print " VALUE='$username'>\n";
> print " value='$user_num'>";
> print " value='$user_addres'>";
>   print "";
> print "";
> 
> ?>
>
> ** second file file2.php 
>  
> ?>
>
> 
> 
>
>   print "";
>  print "";
>  print "";
> ?>
>
> Name:
> User Number:  ?>
> Address:  ?>
> ...
> 
> 
> 
> ..
>
>
> Kind Regrads
> Adam
> I hope someone  can help me. Thanks
>
> _
> Stay in touch with absent friends - get MSN Messenger
> http://www.msn.co.uk/messenger
>
> --
> 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] mysql - SELECT DISTINCT problem

2004-05-08 Thread Daniel Clark
Very odd.  I would think it would return every record seeing as the auto_increment ID 
field is different for every record.


>>I use "SELECT DISTINCT tip, marca, model FROM modele" to select
>>records without duplicates on the field "tip". This works ok, BUT if I
>>use "SELECT DISTINCT tip, marca, model, id FROM..." (id is
>>auto_increment and is the table's primary key) my query won't produce
>>any result. ANyone has a clue? Thank you!

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



Re: [PHP-DB] Re: how to parse php code stored in databases?

2004-05-08 Thread Daniel Clark
Torsten is right.  eval() works great ... and so does having your php code in the 
database :-)

>>"Florian Wagner" <[EMAIL PROTECTED]> wrote in message
>>news:[EMAIL PROTECTED]
>>> Hi there,
>>> I thought it would be a great idea to store the code of nearly all my web
>>> pages in "text" fields of a mysql database.
>>> Now I've got the problem that I want to use php in those pages.
>>> Let's say $row["content"] contains the string "".
>>> Then echo $row["content"] only produces the unparsed >World!'
>>> ?> which effectivly displays nothing, because the browser doesn't know the
>>> ">>
>>> Thanks for any suggestions...
>>
>>This can be done with eval():
>>http://de.php.net/manual/en/function.eval.php
>>
>>Take a look at the user comments there, especially regarding the inclusion
>>of .
>>
>>Regards, Torsten




Re: [PHP-DB] Image / file uploader

2004-05-06 Thread Daniel Clark
I think you need the quotes: $_SERVER['PHP_SELF']

> Try using the following:
>
> $_SERVER[PHP_SELF]
>
> Mainly, get rid of the quotes inside the brackets. Usually this error
> 'T_String' generally occurs when you have quotes (" or ') where they
> shouldn`t be.
>
> Give it a try if that thing still troubles you...
> Good luck

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



RE: [PHP-DB] headers and if statements

2004-04-30 Thread Daniel Clark
We've ALL done it before :-)

> I am testing now testing it with the ==, silly mistake
>
> -Original Message-
> From: John W. Holmes [mailto:[EMAIL PROTECTED]
> Sent: Friday, April 30, 2004 4:38 PM
> To: Erik Meyer; PHP-DB
> Subject: Re: [PHP-DB] headers and if statements
>
>
> From: "Erik Meyer" <[EMAIL PROTECTED]>
>
>> Have you tried:
>> 
>
> Uhmm... Have _YOU_ tried that???
>
> = vs == ?
>
> ;)
>
> ---John Holmes...
>
> --
> 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] headers and if statements

2004-04-30 Thread Daniel Clark
I think that would try to set $login=1.

Need two ==

> Have you tried:
> 
>
> -Original Message-----
> From: Daniel Clark [mailto:[EMAIL PROTECTED]
> Sent: Friday, April 30, 2004 4:19 PM
> To: matthew perry
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] headers and if statements
>
>
> Hum.  Is $logIn null at times?!?!
>
>> 
>>
>> Why does this direct me to loginError.php even when $logIn = 1?
>>
>> - Matt
>
> --
> 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] headers and if statements

2004-04-30 Thread Daniel Clark
Hum.  Is $logIn null at times?!?!

> 
>
> Why does this direct me to loginError.php even when $logIn = 1?
>
> - Matt

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



Re: [PHP-DB] Image / file uploader

2004-04-30 Thread Daniel Clark
Still should be able to use the \" double quotes.

echo (" does it puke when its not using _self?
>
> Craig Hoffman wrote:
>
>> This is really becoming an irritating small bug.  I tried the curly
>> brackets and the photo name still does not show up when I echo out the
>> query.  Everything else about the script works fine.  Why does PHP choke
>> on forms that submit files to themselves?  I am slowly running out
>> things to try...
>>
>> Suggestions?
>>
>> Thanks for everyone's help.
>> CH
>> __
>> Craig Hoffman - eClimb Media
>>
>> v: (847) 644 - 8914
>> f: (847) 866 - 1946
>> e: [EMAIL PROTECTED]
>> w: www.eclimbmedia.com
>> _
>> On Apr 30, 2004, at 5:05 AM, Ford, Mike [LSS] wrote:
>>
>>> On 30 April 2004 01:10, Craig Hoffman wrote:
>>>
 When I put single quotes in the PHP_SELF and I get this error:
 Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE,
 expecting T_STRING or T_VARIABLE or T_NUM_STRING

 and I can't use double quotes because its in an echo statement.  What
 am I missing?
>>>
>>>
>>> Curly braces:
>>>
>>>echo (">> encType='multipart/form-data'>
>>>
>>> Cheers!
>>>
>>> Mike
>>>
>>> -
>>> Mike Ford,  Electronic Information Services Adviser,
>>> Learning Support Services, Learning & Information Services,
>>> JG125, James Graham Building, Leeds Metropolitan University,
>>> Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
>>> Email: [EMAIL PROTECTED]
>>> Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211
>>
>>
>
> --
> 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] Image / file uploader

2004-04-29 Thread Daniel Clark
Change to double quotes for the HTML portion.

action=\"$_SERVER['PHP_SELF']\"

> When I put single quotes in the PHP_SELF and I get this error:
> Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE,
> expecting T_STRING or T_VARIABLE or T_NUM_STRING
>
> and I can't use double quotes because its in an echo statement.  What
> am I missing?
> echo (" encType='multipart/form-data'>
>
> Any more thoughts?
> CH
> __
> Craig Hoffman - eClimb Media
>
> v: (847) 644 - 8914
> f: (847) 866 - 1946
> e: [EMAIL PROTECTED]
> w: www.eclimbmedia.com
> _
> On Apr 29, 2004, at 6:49 PM, Daniel Clark wrote:
>
>> I think you want single quotes around PHP_SELF.
>>
>> "$_SERVER['PHP_SELF']"
>>
>>> I have a script where it uploads a image to directory.   I have used
>>> the script several times and it works when I send the form to another
>>> page.  The problem is I have changed the form to submit to itself and
>>> I
>>> can't seem to get it to work.
>>>
>>> echo (" >> encType='multipart/form-data'>");
>>>
>>> The thing is all my other fields update except for the image.
>>> Further,
>>> the image does not even show up if I echo the query out.
>>>
>>> UPDATE users SET bio = 'Bio - Test', goals = 'Goals - Test', fav_race
>>> =
>>> 'Fav Races - test', fav_train = 'Traing -test', photo_name = '' WHERE
>>> user_id = '1'
>>> Here is the code of the image uploader and my query, perhaps someone
>>> could take a look let me know what I'm missing.
>>> Thanks - CH
>>>
>>> 
>>>
>>> if($_POST["postback_bio"])
>>> {
>>>
>>> include "include/dbadmin.php";
>>>
>>> //image uploader
>>> $uploadpath = '/images/clients/';
>>>
>>> $source = $HTTP_POST_FILES['photo']['tmp_name'];
>>> $photo_name = $HTTP_POST_FILES['photo']['name'];
>>> $dest = '';
>>> if (($source != '') && ($source != '')) {
>>> $dest = $uploadpath.$photo_name;
>>> if ($dest = '') {
>>> if (move_uploaded_file($source, $dest)) {
>>> echo ("Image and Bio has been 
>>> successfully
>>> stored. ");
>>> } else {
>>> echo ("Image could not be 
>>> stored.");
>>> }
>>> }
>>> } else {
>>> echo ("No new image supplied.");
>>> $photo_name = $oldimage;
>>> }
>>>
>>> //declare varibles
>>> $user_id = $_POST["user_id"];
>>> $name = $_POST["name"];
>>> $bio = $_POST["bio"];
>>> $goals = $_POST["goals"];
>>> $fav_race = $_POST["fav_race"];
>>> $fav_train = $_POST["fav_train"];
>>> $photo = $_POST["photo_name"];
>>>
>>> $query = "UPDATE users SET bio = '$bio', goals = '$goals', fav_race =
>>> '$fav_race', fav_train = '$fav_train', photo_name = '$photo_name'
>>> WHERE user_id = '$user_id'";
>>> echo $query;
>>> $msg = "Could not update
>>> record";
>>> $result = mysql_query($query, $db);
>>>
>>> }
>>>
>>>
>>> __
>>> Craig Hoffman - eClimb Media
>>>
>>> v: (847) 644 - 8914
>>> f: (847) 866 - 1946
>>> e: [EMAIL PROTECTED]
>>> w: www.eclimbmedia.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
>>
>
> --
> 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] Image / file uploader

2004-04-29 Thread Daniel Clark
I think you want single quotes around PHP_SELF.

"$_SERVER['PHP_SELF']"

> I have a script where it uploads a image to directory.   I have used
> the script several times and it works when I send the form to another
> page.  The problem is I have changed the form to submit to itself and I
> can't seem to get it to work.
>
> echo ("  encType='multipart/form-data'>");
>
> The thing is all my other fields update except for the image.  Further,
> the image does not even show up if I echo the query out.
>
> UPDATE users SET bio = 'Bio - Test', goals = 'Goals - Test', fav_race =
> 'Fav Races - test', fav_train = 'Traing -test', photo_name = '' WHERE
> user_id = '1'
> Here is the code of the image uploader and my query, perhaps someone
> could take a look let me know what I'm missing.
> Thanks - CH
>
> 
>
> if($_POST["postback_bio"])
>   {
>
>   include "include/dbadmin.php";
>
>   //image uploader
>   $uploadpath = '/images/clients/';
>
>   $source = $HTTP_POST_FILES['photo']['tmp_name'];
>   $photo_name = $HTTP_POST_FILES['photo']['name'];
>   $dest = '';
>   if (($source != '') && ($source != '')) {
>   $dest = $uploadpath.$photo_name;
>   if ($dest = '') {
>   if (move_uploaded_file($source, $dest)) {
>   echo ("Image and Bio has been 
> successfully
> stored. ");
>   } else {
>   echo ("Image could not be 
> stored.");
>   }
>   }
>   } else {
>   echo ("No new image supplied.");
>   $photo_name = $oldimage;
>   }
>
>   //declare varibles
>   $user_id = $_POST["user_id"];
>   $name = $_POST["name"];
>   $bio = $_POST["bio"];
>   $goals = $_POST["goals"];
>   $fav_race = $_POST["fav_race"];
>   $fav_train = $_POST["fav_train"];
>   $photo = $_POST["photo_name"];
>
>   $query = "UPDATE users SET bio = '$bio', goals = '$goals', fav_race =
> '$fav_race', fav_train = '$fav_train', photo_name = '$photo_name'
> WHERE user_id = '$user_id'";
>   echo $query;
>   $msg = "Could not update
> record";
>   $result = mysql_query($query, $db);
>
>   }
>
>
> __
> Craig Hoffman - eClimb Media
>
> v: (847) 644 - 8914
> f: (847) 866 - 1946
> e: [EMAIL PROTECTED]
> w: www.eclimbmedia.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] Session

2004-04-27 Thread Daniel Clark
Depends on the browser.   IE and Netscsape handle opening another window
differently.

> Hi, I have a problem in handling session... so I just reply in this topic.
>
> I have created a site... when user login from one browser ..i set a
> session['user']
>
> the problem is that when user open another browser ...he is not login
> ...he
> have to login again...
>
> So that 1 pc may login as 2 or more different user from different
> browser...
>
> Nicholas Sk2
>
> --
> 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] First letter

2004-04-27 Thread Daniel Clark
$rest = substr("abcdef", 1, 3); // returns "bcd"

http://www.phpbuilder.com/manual/function.substr.php


> What PHP function returns just the first letter of a string?
> - Matt
>
> --
> 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: [PHP] What's wrong with this IF statement?

2004-04-22 Thread Daniel Clark
What about removing the quotes around the numbers.

 if ($cat_id != 53 || $cat_id != 54 || $cat_id != 55 etc...


> My IF statement should be picking up on the numbers, and if the number
> matches not be displaying out the information, however I look at the
> outputted page and the information is still there, what have I got wrong
> on the code?
>
> 
> //Show categories first
> $get_cats = "select id_num, id_name, description, cat_code from
> categories order by id_name";
> $get_cats_res = mysql_query($get_cats) or die(mysql_error());
>
> if (mysql_num_rows($get_cats_res) < 1)
> {
>  $display_block = "Sorry, no categories to browse.";
> }
> else
> {
>  while ($cats = mysql_fetch_array($get_cats_res))
>  {
>   $cat_id = $cats[id_num];
>   if ($cat_id != "53" || $cat_id != "54" || $cat_id != "55" || $cat_id
> != "117" || $cat_id != "118" || $cat_id != "74")
>   {
>   $cat_title = strtoupper(stripslashes($cats[id_name]));
>   $cat_desc = stripslashes($cats[description]);
>   $display_block .= " href=$_SERVER[PHP_SELF]?cat_id=$cat_id>$cat_title
> $cat_desc\n";
>   while ($items = mysql_fetch_array($get_items_res))
>{
> $item_id = $items[id];
> $item_num = $items[item_num];
> $item_desc = stripslashes($items[description]);
> if ($item_num != "ABC-R37" || $item_num !=  "ABC-R42" || $item_num
> != "HB-99100" || $item_num != "RO-PUMPS" || $item_num != "ML-HDGALJUG"
> || $item_num != "PFS-CAC21" || $item_num != "PFS-CO2")
> {
> $item_num = ltrim($item_num);
> $item_num = rtrim($item_num);
> $display_block .= " href=\"catalog/$item_id.html\">$item_num -
> $item_desc\n";
> }
>}
> 
>
> My assumption is that BOTH IF statements are not working correctly since
> the logic is that if they are built the same they would react the same.
> HELP!
>
> TIA!
> Robert
>
> --
> PHP General 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] logic problem

2004-04-21 Thread Daniel Clark
How about

SELECT distinct badge.id, convert( varchar,eventime,110) as date

Shows all the badge numbers IN on that date.   If the badge number is not
there, they didn't check in at ALL that day.


> This seems too easy to not be able to do it with SQL. There must be
> something we're missing in the query.
> Try this:
>
> select distinct badge.id,convert( varchar,eventime,110) as date,count(*)
> from events, badge where
> events.cardnum = badge.id and devid = '1' and
> convert( varchar, events.eventime, 110) BETWEEN '$startdate' and
> 'enddate'
> and type = '1'
> group by date
>
> In MySQL you don't need to specify a field for count(). And you should
> have to convert the eventime field twice, you should be able to
> reference the calc field in the group by.
>
> On Apr 21, 2004, at 2:19 PM, Adam Williams wrote:
>
>> Yeah I basically had that with my previous SQL statement, I was
>> grouping
>> by event.cardnum instead of counting the cardnums by date.  I think
>> what
>> I'm trying to do is beyond the scope of SQL and I'll have to write some
>> PHP to take the SQL statement results and feed them into an array and
>> count the distinct cardnums for each date and then spit it all into an
>> html table.  thanks
>>
>> On Wed, 21 Apr 2004, Daniel
>> Clark wrote:
>>
>>> AND: any count >=1 shows they came in that day.
>>>
>>> How about:
>>>
>>> SELECT convert( varchar,eventime,110) as date from events, badge,
>>>count(convert( varchar,eventime, 110)) as count
>>> WHERE events.cardnum = badge.id and devid = '1' and
>>>convert( varchar, events.eventime, 110) BETWEEN '$startdate' and
>>> 'enddate'
>>> AND type = '1'
>>> GROUP BY convert( varchar,events.eventime, 110), badge
>>>
>>>
>>>> I'm using some proprietary software/hardware where when a visitor
>>>> swipes
>>>> their entry card, it is recorded in a mssql 2000 server.  My boss
>>>> wants a
>>>> count of unique vistors for a range of dates.  So, I need to have it
>>>> give
>>>> a count of unique vistors, meaning that I need to count all vists
>>>> for a
>>>> day as one visit (because if they go outside to smoke and come back
>>>> and
>>>> swipe their card again to get in, each one is a separate visit, but
>>>> i need
>>>> to count all visits by each person as one visit since i just want to
>>>> know
>>>> if they came at all each day, not how many times they came in).
>>>>
>>>> This is my SQL statement:
>>>>
>>>> select distinct count(convert( varchar,eventime, 110)) as count,
>>>> convert( varchar,eventime,110) as date from events, badge wher
>>>> events.cardnum = badge.id and devid = '1' and
>>>> convert( varchar, events.eventime, 110) BETWEEN '$startdate' and
>>>> 'enddate'
>>>> and type = '1' group by convert( varchar,events.eventime, 110)
>>>>
>>>> for reference, devid = '1' is the hardware device, where everytime it
>>>> triggers, it means someone swiped their card to get in, and type =
>>>> '1'
>>>> means patron (because we have a type = 2 that is for staff and we
>>>> jsut
>>>> want to know how many patrons visited)
>>>>
>>>> When I execute this statement, its returning the result for each
>>>> date of
>>>> the total number of card swipes (so if a person comes in twice on a
>>>> date,
>>>> its recording it as 2 swipes, but I just need to know that they came
>>>> to
>>>> the building at all on this date, so I just need it to register that
>>>> there
>>>> was a count of atleast one for this card that was swiped)
>>>>
>>>> any suggestions?  thanks

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



Re: [PHP-DB] logic problem

2004-04-21 Thread Daniel Clark
AND: any count >=1 shows they came in that day.

How about:

SELECT convert( varchar,eventime,110) as date from events, badge,
   count(convert( varchar,eventime, 110)) as count
WHERE events.cardnum = badge.id and devid = '1' and
   convert( varchar, events.eventime, 110) BETWEEN '$startdate' and 'enddate'
AND type = '1'
GROUP BY convert( varchar,events.eventime, 110), badge


> I'm using some proprietary software/hardware where when a visitor swipes
> their entry card, it is recorded in a mssql 2000 server.  My boss wants a
> count of unique vistors for a range of dates.  So, I need to have it give
> a count of unique vistors, meaning that I need to count all vists for a
> day as one visit (because if they go outside to smoke and come back and
> swipe their card again to get in, each one is a separate visit, but i need
> to count all visits by each person as one visit since i just want to know
> if they came at all each day, not how many times they came in).
>
> This is my SQL statement:
>
> select distinct count(convert( varchar,eventime, 110)) as count,
> convert( varchar,eventime,110) as date from events, badge wher
> events.cardnum = badge.id and devid = '1' and
> convert( varchar, events.eventime, 110) BETWEEN '$startdate' and 'enddate'
> and type = '1' group by convert( varchar,events.eventime, 110)
>
> for reference, devid = '1' is the hardware device, where everytime it
> triggers, it means someone swiped their card to get in, and type = '1'
> means patron (because we have a type = 2 that is for staff and we jsut
> want to know how many patrons visited)
>
> When I execute this statement, its returning the result for each date of
> the total number of card swipes (so if a person comes in twice on a date,
> its recording it as 2 swipes, but I just need to know that they came to
> the building at all on this date, so I just need it to register that there
> was a count of atleast one for this card that was swiped)
>
> any suggestions?  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



Re: [PHP-DB] logic problem

2004-04-21 Thread Daniel Clark
How about:

SELECT convert( varchar,eventime,110) as date from events, badge,
   count(convert( varchar,eventime, 110)) as count
WHERE events.cardnum = badge.id and devid = '1' and
   convert( varchar, events.eventime, 110) BETWEEN '$startdate' and 'enddate'
AND type = '1'
GROUP BY convert( varchar,events.eventime, 110), badge


> I'm using some proprietary software/hardware where when a visitor swipes
> their entry card, it is recorded in a mssql 2000 server.  My boss wants a
> count of unique vistors for a range of dates.  So, I need to have it give
> a count of unique vistors, meaning that I need to count all vists for a
> day as one visit (because if they go outside to smoke and come back and
> swipe their card again to get in, each one is a separate visit, but i need
> to count all visits by each person as one visit since i just want to know
> if they came at all each day, not how many times they came in).
>
> This is my SQL statement:
>
> select distinct count(convert( varchar,eventime, 110)) as count,
> convert( varchar,eventime,110) as date from events, badge wher
> events.cardnum = badge.id and devid = '1' and
> convert( varchar, events.eventime, 110) BETWEEN '$startdate' and 'enddate'
> and type = '1' group by convert( varchar,events.eventime, 110)
>
> for reference, devid = '1' is the hardware device, where everytime it
> triggers, it means someone swiped their card to get in, and type = '1'
> means patron (because we have a type = 2 that is for staff and we jsut
> want to know how many patrons visited)
>
> When I execute this statement, its returning the result for each date of
> the total number of card swipes (so if a person comes in twice on a date,
> its recording it as 2 swipes, but I just need to know that they came to
> the building at all on this date, so I just need it to register that there
> was a count of atleast one for this card that was swiped)
>
> any suggestions?  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



RE: [PHP-DB] URL Problem

2004-04-21 Thread Daniel Clark
Can also open it in read only:

$fp = fopen ("/home/rasmus/file.txt", "r");

> Hi there,
>
> Thanks for the below, but I'll try to explain it a bit better.
>
> I don't have access to the ASP server, it's a general server setup for
> companies, to query their server you must use the ?pid=uniquecompanynumber
> as it tracks your IP to make sure the correct server is connecting.
> Anyway,
> what I need is to be able to query this server and get the url response
> ONLY, in other words, when it sends a response back I need to pick up what
> their URL and any additional values IN their url are, and not the body of
> the page itself.
>
> Does that make more sense?  I didn't get much sleep last night so hard to
> express what I mean.
>
> Chris
>
> Anyway first you have to translate your problem to us.
> In plain english.
>
> But I have spare time, so.. here is the solution for your problem, as I
> understood it.
>
> from php
>  $f = file("http://myserver.com/index.asp?pid=";);
> print_r($f);
> ?>
>
> In ASP you take the pid do what you want to it and then
> <%
> Response.Write( myResult )
> %>
>
> The myResult is what the php will be printing and the value you can use.
>
> Use only one Response.Write in entire .asp

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



Re: [PHP-DB] How to Erase MySQL table.

2004-04-19 Thread Daniel Clark
TRUNCATE table xxx  will delete all the rows of data.
DROP table xxx will delete the table.


> Hi everyone,
>
>   I can not find in my manual a MySQL command which erase permanently a
> table
> and it?s content from a MySQL database.
>
> Thanks in advance
>
>   Charalambos
>
> _
> MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.
> http://join.msn.com/?page=features/virus
>
> --
> 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] Curious if include_once will work better than include

2004-04-13 Thread Daniel Clark
My understanding is include_once() called several times in the same page
or include files will only be included once.

> Curious about "include_once" versus "include".
>
> All my connection stuff is in "conn.php3".
>
> I am planning on including it at the top of the page like this:
> include_once "conn.php3";
>
> Now will that speed things up compared to just using a plain "include". I
> call $connectionSDWIS(which is in the include) 5 different times?
>
> $data = odbc_do($connectionSDWIS,"EXEC sp_SanitarySurveyLatest '$pwsno'");
> $data = odbc_do($connectionSDWIS, "Select Distinct CASE ActivityStatus
> WHEN 'A' THEN 'ACTIVE' WHEN 'I' THEN 'INACTIVE' END + ' ' + CASE
> Convert(varchar,ActDate,107) WHEN 'May 05, 1955' THEN '' ELSE
> Convert(varchar,ActDate,107) END As 'ActivityStatus' FROM Inventory Where
> PWSID='$pwsno'");
> $data2 = odbc_do($connectionSDWIS,"Exec sp_EntryPointsWithSourcesAndPWS
> '$pwsno'");
> $data=odbc_do($connectionSDWIS,"SELECT StateID, WSFName, TreatmentProcess,
> TreatmentObjective FROM Treatments WHERE PWS= '$pwsno' ORDER BY StateID");
> $data = odbc_do($connectionSDWIS, "SELECT CalendarYear,
> convert(varchar(12),ReceivedDate, 107), convert(varchar(12),CertifiedDate,
> 107) FROM CCRS WHERE PWS='$pwsno' ORDER BY CalendarYear Desc");

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



Re: [PHP-DB] [PMX:55%] Re: [PHP-DB] get rid of the HTML tags

2004-04-12 Thread Daniel Clark
I've been getting the same errors, sometimes days latter.

> Why are my posts not getting through?  I got 3 Delivery Report Failures on
> Thursday all due to
>
> Diagnostic was Unable to transfer, Message timed out
> Information Message timed out
>

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



Re: [PHP-DB] get rid of the HTML tags

2004-04-12 Thread Daniel Clark
Try strip_tags()

http://www.phpbuilder.com/manual/function.strip-tags.php


> I have this string:
>
> $my_string = "hello worldthis is a test for a
> link with a image 
>
> Is there any function that retrieves only the string without the html
> tags?!

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



Re: [PHP-DB] Session_Start won't work Help?

2004-04-09 Thread Daniel Clark
In PHP.INI there is a variable session.save_path.
Make sure it's uncommented and has a directory to store the temp session
files on the web server.


> I'm running Apache/2.0.49 and PHP/4.3.5 on windows XP. I get warnings:
>
> WARNING: session_start(): open/tmp\sess_242f6f668d85d512f9f4379ffa1e1,
> O_DWR failed: No such file or directory (2) in c:\program files\apache
> group\apache2\htdocs\register_new.php on line 10
>
> I also get another similar warning for seesion start that says cannot send
> seesion cookie and another that says cannot send session cache.
>
> Is this some sort of configuratrion problem in my  httpd.cong file or my
> php.ini file? HELP?
>
> --
> 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] password input type

2004-04-05 Thread Daniel Clark
I'm pretty sure it just shields the "on looker" from viewing.

View source in the browser still shows what the VALUE is, if any.

> Does using a pasword input type 
> make the transfer more secure from someone "sniffing" my connection or
> does it only shield an onlooker from seeing what the user enters?
> - Matt

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



Re: [PHP-DB] Php datetime

2004-03-04 Thread Daniel Clark
I've heard you want to use a TIMESTAMP field for that.


> i have created a mysql table where i would like to store the date and time
> whenever a user logs into a web site. the login is done through php/mysql
> as
> well but i'm not sure what the php code is to add the current date/time
> into
> a mysql database. the field in the db is created as a 'datetime' field.

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



Re: [PHP-DB] mysql_num_rows

2004-03-03 Thread Daniel Clark
>  $query ="SELECT username FROM users WHERE username=('$username')";
> // $result = mysql_query($query, $db);


Above line should be uncommented.


>  if (!$query)

And the "if" checking the number of rows returned from the $result set.

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



Re: [PHP-DB] INSERT dynamic values problem - Need help urgently!

2004-02-27 Thread Daniel Clark
Try:
" .$row["class_code"]. "";



> while ($row = mysql_fetch_array($sql))
> {
>  print "" .$row["class_code"]. "";
>  }
> $result = $db->query($sql);


>

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



RE: [PHP-DB] What's wrong with this query?

2004-02-26 Thread Daniel Clark
What about the single quotes?   Might try this.

$sql = "INSERT INTO log SET term=\'$search\', returns=\'$arrayword\',
time=CURTIME(), date=CURDATE(), ip=\'$ip\'";


> $sql = "INSERT INTO log SET term='$search', returns='$arrayword',
> time=CURTIME(), date=CURDATE(), ip='$ip'";
>
> echo $sql;
>
> $logit = mysql_query($sql) or
>   die(mysql_error());

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



Re: [PHP-DB] Oracle and upper case field name

2004-01-27 Thread Daniel Clark
Yeah, Looks good to me :-)

> Like http://us2.php.net/manual/en/function.array-change-key-case.php ??
>
>> > When Oracle returns the result set, the field names are all in upper
>> case. However, I have an application that needs to work on both
>> MSSQL and Oracle. I don?t want to keep 2 copies. One has upper case
>> field names and the other lower case. How could I make PHP or ADODB
>> to work with lower case field names even the result set is upper
>> case?
>
> ---John Holmes...

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



Re: [PHP-DB] Oracle and upper case field name

2004-01-27 Thread Daniel Clark
I might try having a common PHP function that converts all field names to
lower case, and call that function with every field name.

Or call each field by column number, $row[1]  .


> When Oracle returns the result set, the field names are all in upper
> case. However, I have an application that needs to work on both MSSQL
> and Oracle. I don?t want to keep 2 copies. One has upper case field
> names and the other lower case. How could I make PHP or ADODB to work
> with lower case field names even the result set is upper case?




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