RE: [PHP-DB] CREATE TABLE problem
I have had similar problems before. I have just created your table in MySQL. Seems you can't have an AUTO_INCREMENT column that is UNSIGNED. Doesn't mention this in the manual though. Neil Morgan -Original Message- From: js [mailto:[EMAIL PROTECTED] Sent: 21 January 2004 22:34 To: [EMAIL PROTECTED] Subject: [PHP-DB] CREATE TABLE problem ok im making this page and every single time i try to execute it, it tells me it was not successful. the database name, user,pw,and local host are all correct. i have no idea what do do, and i have 2 more tables besides this one i wanted to create but this was kind of my template for it and i cant even get it to work. im still really bad with this kind of stuff so any help i could get from you is really appreciated. thanks. here is the code: html head titleUntitled Document/title /head body ?php $host = localhost; $user = user; $password = ; $dbname = swwdb; $link = mysql_connect($host,$user,$password); $query = CREATE TABLE staff ( staffid INT(3) NOT NULL AUTO_INCREMENT UNSIGNED, name VARCHAR(255) NOT NULL, login VARCHAR(10) NOT NULL, password VARCHAR(8) NOT NULL, picaddy VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, staffbio TEXT NOT NULL, createdate DATE NOT NULL, tagline VARCHAR(255) NOT NULL, PRIMARY KEY(staffid,login) ); if (mysql_db_query ($dbname,$query,$link)) { print (the query was successfull); } else { print (the query was NOT success); } mysql_close($link); ? /body /html -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] how can I delete a record from txt file
Hi; I take users from Active Directory with ldap functions and put them in a list menu. I have got two txt files. One of them hold the users which have got internet access and one of them holds the users which have got speedily internet access. Also may be a third file that hold the users which have got limited internet access. In my program I must write the selected users to these files. And may be sometimes I must delete some users from these files. How can delete a user from txt file. These files are also in use with some other programs. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP crashes...
Here is the source until something is returned by the first function call (first from top to bottom): ? session_start(); // Template-class require('template.inc.php'); // Some DB-Data [EMAIL PROTECTED] getenv(DOCUMENT_ROOT)./conn.con; if ($dbconn!=1) { sprintf(%s,$dbconn); exit(); } // DB-class -Functions require('db_func.php'); $tpl = new Template(); $tpl-set_file(fi_login,./Tpl/login.tpl.html); $tpl-set_var(array( seitentitel = PAGETITLE, farbe = blue, meldungen = )); ob_start(); if ($_POST['cmd_fislogin']) // $cmd_fislogin is the only button in loginscript { if (($_POST['fis_benutzername']!=) and ($_POST['fis_passwort']!=)) // Textfields: user password { // Create DB-Connection $dbc = new db_con; // $con_ret is TRUE if DB-Connection could be established. $con_ret=$dbc-db_login($db_typ,$db_pfad,$db_name,$db_user,$db_passwort); // if the DB-Connection couldn't be established: echo an error. if ($con_ret!=1) { echo 'brNo DB-Con'.$dbc-db_errormessage; } . . . -- +++ GMX - die erste Adresse für Mail, Message, More +++ Bis 31.1.: TopMail + Digicam für nur 29 EUR http://www.gmx.net/topmail -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MSSQL stability problem
Robert Twitty wrote: Maybe you are running out of connections. The max connections settings in both php.ini and SQL Server are set to unlimited. Is there another limit I am not aware of? -- Stuart On Wed, 21 Jan 2004, Stuart wrote: I have a site that makes heavy use of a local SQL Server database. Every 6-12 hours the site continuously reports not being able to connect to the database. That is the only info in the warning that's given. The only solution I've found is to restart the Apache and MSSQL services. The [MSSQL] section from my php.ini is appended below. IIRC the only values I've changed are mssql.textlimit and mssql.textsize. Has anyone seen this before? What causes it and how can I stop it happening short of restarting the services every 6 hours? Thanks. -- Stuart [MSSQL] ; Allow or prevent persistent links. mssql.allow_persistent = On ; Maximum number of persistent links. -1 means no limit. mssql.max_persistent = -1 ; Maximum number of links (persistent+non persistent). -1 means no limit. mssql.max_links = -1 ; Minimum error severity to display. mssql.min_error_severity = 10 ; Minimum message severity to display. mssql.min_message_severity = 10 ; Compatability mode with old versions of PHP 3.0. mssql.compatability_mode = Off ; Connect timeout ;mssql.connect_timeout = 5 ; Query timeout ;mssql.timeout = 60 ; Valid range 0 - 2147483647. Default = 4096. mssql.textlimit = 2147483647 ; Valid range 0 - 2147483647. Default = 4096. mssql.textsize = 2147483647 ; Limits the number of records in each batch. 0 = all records in one batch. ;mssql.batchsize = 0 ; Specify how datetime and datetim4 columns are returned ; On = Returns data converted to SQL server settings ; Off = Returns values as -MM-DD hh:mm:ss ;mssql.datetimeconvert = On ; Use NT authentication when connecting to the server mssql.secure_connection = Off ; Specify max number of processes. Default = 25 ;mssql.max_procs = 25 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Stuart -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MSSQL stability problem
Stuart wrote: Robert Twitty wrote: Maybe you are running out of connections. The max connections settings in both php.ini and SQL Server are set to unlimited. Is there another limit I am not aware of? I am now closing the connection to MSSQL at the end of every page and it still does it. I've restarted SQL Server (no change) and then the whole machine but it still does it. The connection closing is working because I see no connections to the database in the SQL Server process list. Is anyone using MSSQL with PHP on Windows? Can anyone help... please... :/ -- Stuart -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] CREATE TABLE problem
Regarding... -- $query = CREATE TABLE staff ( -- staffid INT(3) NOT NULL AUTO_INCREMENT UNSIGNED, -- name VARCHAR(255) NOT NULL, -- login VARCHAR(10) NOT NULL, -- password VARCHAR(8) NOT NULL, -- picaddy VARCHAR(255) NOT NULL, -- email VARCHAR(255) NOT NULL, -- staffbio TEXT NOT NULL, -- createdate DATE NOT NULL, -- tagline VARCHAR(255) NOT NULL, -- PRIMARY KEY(staffid,login) ); The problem with the above create table query is the _placement_ of the UNSIGNED keyword. Rather than: staffid INT(3) NOT NULL AUTO_INCREMENT UNSIGNED, try: staffid INT(3) UNSIGNED NOT NULL AUTO_INCREMENT, The second worked for me while the first threw the previously reported SQL Syntax error. HTH, David
[PHP-DB] Drop down box NOT populated
Can anyone tell me what I am missing here, The Select statement does not populate my drop down window? My drop down box is empty ! [snip] ? include '../db.php'; $how = mysql_query(SELECT count(distinct(account)) from Backlog) or die (Something bad happened: . mysql_error()); $how_many = mysql_result($how, 0); echo h3$how_many Accounts to pick from !!!/h3; $sql = mysql_query(SELECT distinct(Account) FROM Backlog)or die (Something bad happened here: . mysql_error()) ; echo select name=\account\\n; echo option\n; while ($row = mysql_fetch_array($sql)) { echo ' option value='.$row[account].''.$row[account]./option\n; } echo /select\n; ? [end snip] Larry Sandwick Sarreid, Ltd. Network/System Administrator phone: (252) 291-1414 x223 fax : (252) 237-1592
Re: [PHP-DB] Drop down box NOT populated
Larry Sandwick wrote: Can anyone tell me what I am missing here, The Select statement does not populate my drop down window? My drop down box is empty ! ? include '../db.php'; $how = mysql_query(SELECT count(distinct(account)) from Backlog) or die (Something bad happened: . mysql_error()); $how_many = mysql_result($how, 0); echo h3$how_many Accounts to pick from !!!/h3; $sql = mysql_query(SELECT distinct(Account) FROM Backlog)or die (Something bad happened here: . mysql_error()) ; echo select name=\account\\n; echo option\n; ^^ Try removing this line. while ($row = mysql_fetch_array($sql)) { echo ' option value='.$row[account].''.$row[account]./option\n; } echo /select\n; ? -- Stuart -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Drop down box NOT populated
- Original Message - From: Larry Sandwick To: [EMAIL PROTECTED] Sent: Thursday, January 22, 2004 3:46 PM Subject: [PHP-DB] Drop down box NOT populated Can anyone tell me what I am missing here, The Select statement does not populate my drop down window? My drop down box is empty ! [snip] ? include '../db.php'; $how = mysql_query(SELECT count(distinct(account)) from Backlog) or die (Something bad happened: . mysql_error()); $how_many = mysql_result($how, 0); echo h3$how_many Accounts to pick from !!!/h3; $sql = mysql_query(SELECT distinct(Account) FROM Backlog)or die (Something bad happened here: . mysql_error()) ; echo select name=\account\\n; echo option\n;-- WHAT IS THIS DOING HERE ! while ($row = mysql_fetch_array($sql)) { echo ' option value='.$row[account].''.$row[account]./option\n; } echo /select\n; ? [end snip] Larry Sandwick Sarreid, Ltd. Network/System Administrator phone: (252) 291-1414 x223 fax : (252) 237-1592
[PHP-DB] editing, deleting records
Here's a part of my code, which is retrieving player records from mysql and displaying them in a table: - if($queryChk3 !== 0){ print(form action='$_SERVER['PHP_SELF']' method='POST' input type='hidden' name='teamID' value='$teamID' input type='hidden' name='pwd' value='$pwd' table border='1'tr td colspan='7'bPlayer Roster for $teamName/b/td/tr trtdbLast Name/b/tdtdbFirst Name/b/td tdbDOB/b/tdtdbTelephone/b/td tdbAddress/b/tdtdbEmail/b/td tdbSex/b/td/tr); while($row = mysql_fetch_array($query3)) { print(tr); $lname = $row['lname']; $fname = $row['fname']; $dob = $row['dob']; $phone = $row['phone']; $address = $row['address']; $email = $row['email']; $sex = $row['sex']; print(td . $lname . /tdtd . $fname . /tdtd . $dob . /tdtd . $phone . /tdtd . $address . /tdtd . $email . /tdtd . $sex . /td); print(/tr); } print(/tableinput type='submit' name='Submit'/form); } -- I'd like to add buttons to edit this record and delete this record to each row but I'm not sure how to get it done. It seems like I'd have to add a hidden variable (playerID, which is my primary key for the table players) to each row printed but how do I manage unique submits since I'm already inside a form? I must be missing something obvious - please help! Thanks, Kirk -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: editing, deleting records
Kirk Babb wrote: Here's a part of my code, which is retrieving player records from mysql and displaying them in a table: - if($queryChk3 !== 0){ print(form action='$_SERVER['PHP_SELF']' method='POST' input type='hidden' name='teamID' value='$teamID' input type='hidden' name='pwd' value='$pwd' table border='1'tr td colspan='7'bPlayer Roster for $teamName/b/td/tr trtdbLast Name/b/tdtdbFirst Name/b/td tdbDOB/b/tdtdbTelephone/b/td tdbAddress/b/tdtdbEmail/b/td tdbSex/b/td/tr); while($row = mysql_fetch_array($query3)) { print(tr); $lname = $row['lname']; $fname = $row['fname']; $dob = $row['dob']; $phone = $row['phone']; $address = $row['address']; $email = $row['email']; $sex = $row['sex']; You coulds do away with the above and replace with while (list($firstname, $lastname.. etc) = mysql_fetch_row($sql_query)) { echo $firstname $lastnamebr\n; } print(td . $lname . /tdtd . $fname . /tdtd . $dob . /tdtd . $phone . /tdtd . $address or instead code as echo td . $row['lname'] . /tdtd . $row['fname'] . /tdtd . /tdtd . $email . /tdtd . $sex . /td); print(/tr); } print(/tableinput type='submit' name='Submit'/form); } -- I'd like to add buttons to edit this record and delete this record to each row but I'm not sure how to get it done. It seems like I'd have to add a hidden variable (playerID, which is my primary key for the table players) to each row printed but how do I manage unique submits since I'm already inside a form? I must be missing something obvious - please help! Get the ID field from DB and put a link in as echo 'trtda href=edit.page?ID=.$row['id'].' have fun Thanks, Kirk -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] @mysql_connect freezes
Hi, I am trying to find a problem with my sql connection now that I have split my sql server from the apache server. (Chain of Events) 1. Copied working web page with php sql commands to a new web server 2. Added apache server/username to new sql servers database auth. 3. Made sure that server, username, and password work by using mysqlcc on that web server and was able to connect to the database on the sql server. When I try to run the following command $dbcnx = @mysql_connect( new_sqlserver,user_name,passwd) or die(Could not connect: . mysql_error()); php does not get past this line! No errors on the web page it just stops processing the php script.No further output from the script or the web page after this line is processed or sent I enabled syslog in the /etc/php.ini but no messages there. Where else can I check for clues? -- Jim Deas [EMAIL PROTECTED] JAD Systems -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Database Abstraction Layer?
I like PEAR::DB myself, especially since so many other PEAR packages build upon it. To make your code even more DB independant, you can use a package which builds the SQL for you, such as DB_DataObject. It can also quote table / column names and values correctly per DB. (Although DB hasn't been uypdated yet with my patch to support table and column quoting.) Muhammed Mamedov wrote: Thanks Ricardo for your comments. What do you think guys: ADODB or PEAR::DB ? - Original Message - From: Ricardo Lopes [EMAIL PROTECTED] To: Muhammed Mamedov [EMAIL PROTECTED] Sent: Wednesday, January 21, 2004 11:21 AM Subject: Re: [PHP-DB] Database Abstraction Layer? You have ADODB and PEAR DB that both work as abstraction layer. I have used ADODB and seems to me that is very good, yet i have not tested PEAR DB... To make php code 100% database independent is not very easy, depends of what are you going to do with your code. Use the ADODB or PEAR functions every time possible, and avoid the using of sql statements in your code because you have to carefull design then to be database independent but that can be a very difficult task. - Original Message - From: Muhammed Mamedov [EMAIL PROTECTED] To: phpdb [EMAIL PROTECTED] Sent: Wednesday, January 21, 2004 8:31 AM Subject: [PHP-DB] Database Abstraction Layer? Hello everybody, What do you think is the best method to abstract php code from a specific database?. Make PHP code 100% database independent?.. Waitin' for your comments. Muhammed Mamedov -- paperCrane Justin Patrin -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Database Abstraction Layer?
There's also PEAR's DB_DataObject which does build SQL for you. The join syntax isn't set up to be totally DB independant yet, but it can and will be. Paul Miller wrote: PEAR is great from what I hear. The issue you are going to run into with DB independence is not the function calls which could be handled with something as simple as sqlalphp. It is the SQL calls themselves. The two options I have found is a SQL library with unembeded SQL or the Propel solution. Either way adds a significant time to coding and product release initially. - Paul -Original Message- From: Muhammed Mamedov [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 21, 2004 10:07 AM To: [EMAIL PROTECTED]; phpdb Subject: Re: [PHP-DB] Database Abstraction Layer? Hmm.. Thank you for you sql picks:) But what do you guys think aabout Pear :: DB? Is it as effective as these Paul's picks? Thank you. Muhammed Mamedov - Original Message - From: Paul Miller [EMAIL PROTECTED] To: phpdb [EMAIL PROTECTED] Sent: Wednesday, January 21, 2004 5:44 PM Subject: RE: [PHP-DB] Database Abstraction Layer? There are a couple of products out there that I am about to start testing, starting first with: - SQL Relay http://sqlrelay.sourceforge.net/ This product uses its on C interfaces to interact with DBs and different programming languages. It addresses a bunch of items in the PHP DB calls. Connection pooling and load balancing. - Propel http://propel.phpdb.org/ Extensive templates create the SQL definition files you need to setup your database and the classes you need to work with your data model in your PHP scripts. The classes for your object model are generated from a simple XML schema and any customizations are written in plain PHP. This will effectively that add SQL and DB dependence out of your mix. This is PHP5 also. HTH - Paul -Original Message- From: Muhammed Mamedov [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 21, 2004 2:31 AM To: phpdb Subject: [PHP-DB] Database Abstraction Layer? Hello everybody, What do you think is the best method to abstract php code from a specific database?. Make PHP code 100% database independent?.. Waitin' for your comments. Muhammed Mamedov -- 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 -- paperCrane Justin Patrin -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] CREATE TABLE problem
hmm ... I have unsigned auto_increment fields in all my tables that use unique field IDs... But i use very long counter fields as it's pretty big tables I have (or gonna be once I get them finished)... FWIW Rene Fate would have it, that on Thu, 22 Jan 2004 08:47:01 -, [EMAIL PROTECTED] wrote: I have had similar problems before. I have just created your table in MySQL. Seems you can't have an AUTO_INCREMENT column that is UNSIGNED. Doesn't mention this in the manual though. Neil Morgan Rene Brehmer aka Metalbunny http://metalbunny.net/ References, tools, and other useful stuff... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php