[PHP-DB] query question
heyas all, the database: KID MID 1 1 1 2 2 2 I have the following code: $PID = 1; $UID = 2; $res = mysql_query(SELECT KID FROM kpr WHERE MID = '$PID' OR MID = '$UID') or die (mysql_error()); $values = (array_values(mysql_fetch_array($res))); for ($i=; $i = count($values); $i++){ print (($i) $values$i] br\n); } problem: If i use option 1 i get the following result: (0) 1 (1) 1 What i expected was: (0) 1 (1) 1 (2) 2 anyone knowz why i don't get that result? TIA -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] MSSQL, Linux and Binaries
Hello, we have stored Images in MS SQL 7 - Database. With freetds we can read all Information - but on Binaries (Images) we became wrong informations. If we store the Data in a File, the Filesize is (as example) 34 kbyte. The original filesize are 17 kbye. what can we do to convert the informations in right format? Greetings Torsten -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] creating a date array
trying to make an array with every date (in -MM-DD format) of the current week in it... the below code ain't working, any ideas?! cheers, dave function createdatearray($sunday){ $date = date('Ymd',strtotime($date)); for($x=0; $x=7; $x++){ $y = $x + 1; $date[$y] = mktime(0,0,0,date('m'),date('d')-date('w')+$x ,date('Y')); } return $date; } _ Stay in touch with absent friends - get MSN Messenger http://messenger.msn.co.uk -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] creating a date array
trying to make an array with every date (in -MM-DD format) of the current week in it... the below code ain't working, any ideas?! cheers, dave function createdatearray($sunday){ $date = date('Ymd',strtotime($date)); for($x=0; $x=7; $x++){ $y = $x + 1; $date[$y] = mktime(0,0,0,date('m'),date('d')-date('w')+$x ,date('Y')); } return $date; } It works just fine. You're adding Unix timestamps to $date, though, not a formatted -MM-DD date. To do that, you need: $date[$y] = date('Y-m-d',mktime(0,0,0,date('m'),date('d')-date('w')+$x ,date('Y'))); ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] date to Y-M-D
a function to convert any date to ymd... function datetoymd($date){ $dateymd = date('Y-m-d',$date); return $dateymd; } this function when output gives me the date 1970-01-01 (date of the unix timestamp start) so, ehm, why!? cheers, dave _ Stay in touch with absent friends - get MSN Messenger http://messenger.msn.co.uk -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] date to Y-M-D
function datetoymd($date){ $dateymd = date('Y-m-d',$date); return $dateymd; } this function when output gives me the date 1970-01-01 (date of the unix timestamp start) so, ehm, why!? Because you're not passing a valid Unix timestamp or whatever your passing is empty. ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] date to Y-M-D
ehmmm what kind of dates do you use, maybe dates of birth? when using date of unix timestamp you can't have dates befor 1970 so if those timestamps represents an older date you can't use timestamps! -mark- -Oorspronkelijk bericht- Van: David Rice [mailto:[EMAIL PROTECTED] Verzonden: Tuesday, March 25, 2003 3:42 PM Aan: [EMAIL PROTECTED] Onderwerp: [PHP-DB] date to Y-M-D a function to convert any date to ymd... function datetoymd($date){ $dateymd = date('Y-m-d',$date); return $dateymd; } this function when output gives me the date 1970-01-01 (date of the unix timestamp start) so, ehm, why!? cheers, dave _ Stay in touch with absent friends - get MSN Messenger http://messenger.msn.co.uk -- 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] Table structure
Hi, I would be very grateful if someone could look at my table design for me please. The sytem will be used to allow users to log in to a web site and book staff. Here is my design so far. # -- MySQL dump -- # # Table structure for table 'WMS_Allocations' # CREATE TABLE WMS_Allocations ( Allocation_ID int(11) DEFAULT '' NOT NULL auto_increment, Project_ID int(11) DEFAULT '0' NOT NULL , User_ID int(11) DEFAULT '0' NOT NULL , PRIMARY KEY (Allocation_ID), KEY Project_ID (Project_ID,User_ID) ); # # Table structure for table 'WMS_Bookings' # CREATE TABLE WMS_Bookings ( Booking_ID int(11) DEFAULT '' NOT NULL auto_increment, Booking_Date date DEFAULT '-00-00' NOT NULL , PCT_address varchar(255), PCT_postcode varchar(255), PCT_telephone varchar(255), PCT_manager varchar(255), PCT_gp varchar(255), P_address varchar(255), P_postcode varchar(255), P_telephone varchar(255), P_manager varchar(255), P_gp varchar(255), Allocation_ID int(11), PRIMARY KEY (Booking_ID), KEY Allocation_ID (Allocation_ID) ); # # Table structure for table 'WMS_Projects' # CREATE TABLE WMS_Projects ( Project_ID int(11) DEFAULT '' NOT NULL auto_increment, Project_Name varchar(255), PRIMARY KEY (Project_ID) ); # # Table structure for table 'WMS_User' # CREATE TABLE WMS_User ( User_ID int(11) DEFAULT '' NOT NULL auto_increment, User_Username varchar(100) DEFAULT '' NOT NULL , User_Password varchar(100) DEFAULT '' NOT NULL , User_Name varchar(100) DEFAULT '' NOT NULL , User_Type int(11) DEFAULT '0' NOT NULL , User_Email varchar(100), PRIMARY KEY (User_ID), UNIQUE User_Username (User_Username) ); A user could be a client, a staff member, or an administrator. Clients can log in and book staff to their own projects. Administrators can log in, allocate staff to any project, add/edit/delete - projects/staff/clients, and book staff on a project they are allocated to. A staff member will be able to log in and complete a booking they have undertaken and add in data needed for the project. At the moment i have a single table to incorporate all three types of user but i think i need to change this as the relationship between a client and a project is different to a staff member/administrator and a project. A client can have many projects but a project will only belong to one client where as a staff member/administrator could be allocated to many projects and project could be allocated to many staff members/administrators. My MySQL installation doesnt support Foreign Keys which makes life a little difficult! Any thoughts comments on this would be greatly appreciated. Thanks for your time. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP-DB] mssql_query ROLLBACK
You can't split a transaction between multiple calls to mssql_query. The memory used (in the server and client) are cleared between each call. You would have to create a batch of statements and execute these with one call to mssql_query. No, I found solution in the end!: SET XACT_ABORT OFF It should be by default OFF and it is when I connect using Query Analyser, but when I connect using PHP, it is ON. I had to use mssql_query(SET XACT_ABORT OFF); and everything works as I expected. -- \|||/ Prevít (. .) (já) mailto:[EMAIL PROTECTED] --==-o00o-(_)-o00o-==- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] creating a date array
You also need to give your array a different name so this should work : function createdatearray($sunday){ $date = date('Ymd',strtotime($date)); for($x=0; $x=7; $x++){ $y = $x + 1; $date1[$y] = date('Y-m-d',mktime(0,0,0,date('m'),date('d')-date('w')+$x,date('Y'))); } return $date1; } Sincerely berber Visit http://www.weberdev.com/ Today!!! To see where PHP might take you tomorrow. -Original Message- From: CPT John W. Holmes [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 25, 2003 4:31 PM To: David Rice; [EMAIL PROTECTED] Subject: Re: [PHP-DB] creating a date array trying to make an array with every date (in -MM-DD format) of the current week in it... the below code ain't working, any ideas?! cheers, dave function createdatearray($sunday){ $date = date('Ymd',strtotime($date)); for($x=0; $x=7; $x++){ $y = $x + 1; $date[$y] = mktime(0,0,0,date('m'),date('d')-date('w')+$x ,date('Y')); } return $date; } It works just fine. You're adding Unix timestamps to $date, though, not a formatted -MM-DD date. To do that, you need: $date[$y] = date('Y-m-d',mktime(0,0,0,date('m'),date('d')-date('w')+$x ,date('Y'))); ---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-DB] Empty display loop...
I am working on a page that displays a line of information with a checkbox at the end. I began by getting all of the information I wanted displayed working properly and now I am adding the checkbox. Everything is going find with the exception that all of a sudden with the checkbox code in I am getting an empty line and checkbox at the beginning of the loop. I cannot figure out where this is coming from. Please let me know where I have gone wrong. table width=90% bgcolor=#CC cellspacing=0 tr td width=20% height=23div align=centerRequesting User ID/div/td td width=10% valign=topdiv align=centerSystem Name/div/td td width=10% valign=topdiv align=centerPrimary Group/div/td td width=10% valign=topdiv align=centerDefault Shell/div/td td width=30% valign=topdiv align=centerRequest Time/div/td td width=10% valign=topdiv align=centerCompleted/div/td /tr form method=post action=account_details.php ?php do { $entry = $list['id_sys']; $id = split('-', $list['id_sys']); $sbcuid = $id[0]; $sys = $id[1]; echo td width=\20%\div align=\center\.$sbcuid./div/td; echo td width=\10%\div align=\center\.$sys./div/td; echo td width=\15%\div align=\center\.$list['gid']./div/td; echo td width=\15%\div align=\center\.$list['shell']./div/td; echo td width=\30%\div align=\center\.$list['atime']./div/td; echo td width=\10%\div align=\center\input name=\entry[]\ type=\checkbox\ value=$entry/div/td/tr; } while ($list = mysql_fetch_assoc($result)); ? /table div align=center input type=submit value=Details /div /form This is the code for all of the section dealing with the data display. The rest of the page is just some extra text and formatting, as well as the actual query code. Thanks again. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Empty display loop...
Scott V Nipp [EMAIL PROTECTED] wrote: I am working on a page that displays a line of information with a checkbox at the end. I began by getting all of the information I wanted displayed working properly and now I am adding the checkbox. Everything is going find with the exception that all of a sudden with the checkbox code in I am getting an empty line and checkbox at the beginning of the loop. I cannot figure out where this is coming from. Please let me know where I have gone wrong. Snipping a lot so you can see the problem: table width=90% bgcolor=#CC cellspacing=0 form method=post action=account_details.php /table /form Your nesting is bad. Put the form tag before the table. And you don't have a tr in your loop. Regards... Michael -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php