[PHP] Re: mysql question #2
nihilism machine wrote: Ok, I read the php.net info. so with this function though: public function select_one($sql) { $this-last_query = $sql; $r = mysql_query($sql); if (!$r) { $this-last_error = mysql_error(); return false; } if (mysql_num_rows($r) != 1) { return false; } $ret = mysql_result($r, 0); mysql_free_result($r); if ($this-auto_slashes) { return stripslashes($ret); } else { return $ret; } } how can i get the contents of a column in the returned row say for something called Email as the column name. here is my code now: HUH? // Attempt to login a user public function CheckValidUser($Email, $Password) { $PasswordEncoded = $this-encode($Password); $sql = SELECT * FROM CMS_Users WHERE Email='$Email' AND Password='$PasswordEncoded'; $result = $this-DB-select_one($sql); if ($result) { // User info stored in Sessions $_SESSION['Status'] = loggedIn; $_SESSION['ID'] = $row['ID']; $_SESSION['Email'] = $row['Email']; $_SESSION['AdminLevel'] = $row['AdminLevel']; $_SESSION['FirstName'] = $row['FirstName']; $_SESSION['LastName'] = $row['LastName']; return true; } else { return false; } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: mysql question
Man-wai Chang wrote: I tried to post to mysql.general, but the message never appeared. So I am trying my luck here. How could I build an index for a table created using the CREATE TEMPORARY TABLE ... SELECT ... FROM ... syntax, using an account without the privilege to use ALTER TABLE? See the docs. CREATE INDEX syntax: http://dev.mysql.com/doc/refman/5.0/en/create-index.html About privileges: http://dev.mysql.com/doc/refman/5.0/en/grant.html You didn't send much info along, so I assume you're using some version of MySQL 5.0. HTH -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: mysql question
You didn't send much info along, so I assume you're using some version of MySQL 5.0. Thanks. I figured it out (doesn't need 5.0): CREATE TEMPORARY haha ( KEY (field1), KEY (field2) ) AS SELECT po_no, po_date, item_no FROM . WHERE Then I don't need the privilege for ALTER TABLE. -- .~. Might. Courage. Vision. Sincerity. http://www.linux-sxs.org / v \ Simplicity is Beauty! May the Force and Farce be with you! /( _ )\ (Fedora Core 4) Linux 2.6.17-1.2142_FC4 ^ ^ 17:33:02 up 165 days 1:17 1 user load average: 0.03 0.08 0.08 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: mysql question
CREATE TEMPORARY haha ( KEY (field1), KEY (field2) ) AS SELECT po_no, po_date, item_no FROM . WHERE Then I don't need the privilege for ALTER TABLE. I meant I could build index on a temp table without the privilege to use ALTER TABLE by making the index definitions as part of the CREATE TEMPORARY statement. -- .~. Might. Courage. Vision. Sincerity. http://www.linux-sxs.org / v \ Simplicity is Beauty! May the Force and Farce be with you! /( _ )\ (Fedora Core 4) Linux 2.6.17-1.2142_FC4 ^ ^ 17:40:01 up 165 days 1:24 1 user load average: 0.02 0.04 0.06 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: MySQL question
I would have at least expected it give me 'margaret atwood' before it gives me 'margaret' and then 'atwood'. Sorry, MySQL question. Any takers? If I search for 'margaret atwood', I get results in no real structured heirachy. Any thoughts? SELECT ST,BT,AT FROM ccl_main WHERE MATCH (ST,BT,AT) AGAINST ('margaret atwood' IN BOOLEAN MODE);h1Search font color=blueccl.ccl_main/font For: font color=blueimargaret atwood/i/font - 275 record(s) found/h1 John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: MySQL question
John Taylor-Johnston wrote: Sorry, MySQL question. Any takers? If I search for 'margaret atwood', I get results in no real structured heirachy. Any thoughts? SELECT ST,BT,AT FROM ccl_main WHERE MATCH (ST,BT,AT) AGAINST ('margaret atwood' IN BOOLEAN MODE);h1Search font color=blueccl.ccl_main/font For: font color=blueimargaret atwood/i/font - 275 record(s) found/h1 John The results from IN BOOLEAN MODE are not sorted in order of relevance, from what I can see in the docs. More info can be found at http://dev.mysql.com/doc/mysql/en/Fulltext_Boolean.html Depending on what you are trying to achieve, BOOLAEN MODE may not be what you want. David -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: mysql question
Christian Calloway em Friday 26 July 2002 17:30 foi agraciado com uma resposta por: Sorry this may be a little offtopic, but I am currently moving a site I was developing from coldfusion+MSAccess to PHP+MySQL. I remembered reading somewhere that there is a utility that will convert/transfer (data and structure) a MSAcess database to Mysql, and vice versa. Anyone know? Thanks Chris Yes, it's called DBTools. Google for it because it's easy to find. -- -- http://gnet.inerciasensorial.com.br -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: mysql question --
Got it figured out -- To export table structure: C: mysqldump -d {database name} {tables} sqltextfile.sql Then to import the new Table Structure: To import table structure / data C: mysql {database name} sqltextfile.sql Just a note: If you want to copy the structure of an existing table with the intent of creating *another* table in the same DB with the same structure, then make sure you edit the sqltextfile.sql file and change the CREATE TABLE {table name} to something else. For example: C: mysqldump -d mydb subscribers subscribers.sql ** edit the subscribers.sql text file and change the following line: CREATE TABLE subscribers to CREATE TABLE subscribers2 (or whatever) save... then C: mysql mydb subscribers.sql that's it... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: mysql question
You can use an id field in your table structure that is set to auto increment for each entry into database then just do a query on the id number you wish to view... of course this would mean that you would need to create a new field on your table but that should get you what you need. Jas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php