Re: [PHP-DB] Hiding Admin Link
Easy way to do it is if you use a MySQL database to store it. Do $username = (name of user); $admin = mysql_query( SELECT * FROM usertable WHERE user='$username' ); if( $admin-admin ) { print a href='/adminarea'ADMIN/a } $username -- variable to hold the name of the user. $admin -- query to obtain the database row for that user if() -- checks to see if the admin status column of the database is set to true, if so it prints admin link. On Thu, Apr 30, 2009 at 9:29 PM, Joey Hendricks j.hendrick...@comcast.netwrote: Hello, I am very new at PHP so I will try to explain my question the best I can. I was wondering if there was a way to have a link show only to the owner of the site? Like having a Admin link for editing posts, but hidden to all users except the owner. Thank you very much for your time!!
Re: [PHP-DB] Hiding Admin Link
You can start by creating a login system http://www.phpeasystep.com/workshopview.php?id=6 Then you can do an if/then statement to show the link only to people who have logged in... On 4/30/2009 10:29 PM, Joey Hendricks wrote: Hello, I am very new at PHP so I will try to explain my question the best I can. I was wondering if there was a way to have a link show only to the owner of the site? Like having a Admin link for editing posts, but hidden to all users except the owner. Thank you very much for your time!! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PostgreSQL query many escape characters?
Hello, I am very new to this process, so please forgive me if this is a silly question. I have a number of PostgreSQL tables that use the naming convention that capitalizes the first character of each word, therefor the data names require quotes. When I put together my queries using parameters for the selected columns and the table names and use pg_query_params instead of pg_query to build the query? Doing it without the parameterization looks like this... $query = SELECT tp.\peopleId\,\fName\,\mName\,\lName\, \contactItem\ FROM \tblPeople\ tp LEFT JOIN \brdgPeopleContactInformation\ bpci ON tp. \peopleId\ = bpci.\peopleId\ LEFT JOIN \tblContactInformation\ tci ON bpci. \contactInformationId\ = tci.\contactInformationId\ WHERE (\lName\ like '$l_name' AND \fName\ IS NULL) OR (\lName\ like '$l_name' AND \fName\ LIKE '$f_name') ORDER BY \lName\,\fName\,\mName\; $SciName = pg_query($query); This actually works, believe it or not, but my next query where I'm doing an insert to the tables does not. Thank you in advance for your time. Carol -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PostgreSQL query many escape characters?
Hi, you should post the INSERT query too. I'd recommend you to print the query before running it. Just put echo $query; before/after pg_query(). You'll see what are you sending to the database. This may help you find the problem. Also using ` instead of in query may help you to make it easier to read. Carol Walter napsal(a): Hello, I am very new to this process, so please forgive me if this is a silly question. I have a number of PostgreSQL tables that use the naming convention that capitalizes the first character of each word, therefor the data names require quotes. When I put together my queries using parameters for the selected columns and the table names and use pg_query_params instead of pg_query to build the query? Doing it without the parameterization looks like this... $query = SELECT tp.\peopleId\,\fName\,\mName\,\lName\,\contactItem\ FROM \tblPeople\ tp LEFT JOIN \brdgPeopleContactInformation\ bpci ON tp.\peopleId\ = bpci.\peopleId\ LEFT JOIN \tblContactInformation\ tci ON bpci.\contactInformationId\ = tci.\contactInformationId\ WHERE (\lName\ like '$l_name' AND \fName\ IS NULL) OR (\lName\ like '$l_name' AND \fName\ LIKE '$f_name') ORDER BY \lName\,\fName\,\mName\; $SciName = pg_query($query); This actually works, believe it or not, but my next query where I'm doing an insert to the tables does not. Thank you in advance for your time. Carol -- S pozdravem Daniel Tlach Freelance webdeveloper Email: m...@danaketh.com ICQ: 160914875 MSN: danak...@hotmail.com Jabber: danak...@jabbim.cz
Re: [PHP-DB] PostgreSQL query many escape characters?
Okay, Here are the queries I've written. I gave up on trying to make pg_query_params() work but this is what I have using pg_query(). I have been printing the query. In fact, I can take the query as constructed, paste it into psql and it runs just fine. I would be grateful for any help you can give. This program will have three other queries which are more complex that this one. /* Build variables by concatenating with single quotes. */ $new_f_name_new = ' . $f_name_new . '; $new_m_name_new = ' . $m_name_new . '; $new_l_name_new = ' . $l_name_new . '; $new_ivl_web_peop = ' . $ivl_web_peop . '; $new_cns_web_peop = ' . $cns_web_peop . '; $new_cont_rank = ' . $cont_rank . '; $new_cont_loc = ' . $cont_loc . '; $new_contact_info1 = ' . $contact_info1 . '; $new_contact_type = ' . $contact_type . '; /* Execute queries to insert record in people table, contact table, and people - contact bridge table. */ $query = INSERT INTO \tblPeople\(\fName\,\mName \,\lName\, ivlweb, cnsweb) VALUES ($new_f_name_new, $new_m_name_new, $new_l_name_new, $new_ivl_web_peop, $new_cns_web_peop);; echo First query: . $query . br /; $pg_peop_ins = pg_query($query); echo pg_result_error($pg_peop_ins); $query = INSERT INTO \tblContactInformation \(\contactItem\,\contactType\) VALUES ($new_contact_info1, $new_contact_type); echo Second query: . $query . br /; $pg_contact_ins = pg_query($query) or die(Can't execute 2nd query); $query = INSERT INTO \brdgPeopleContactInformation\ (\peopleId\,\contactInformationId \,rank, type) VALUES (currval('\tblPeople_peopleId_seq \'),currval('\tblContactInformation_contactInformationId_seq\'), $new_cont_rank, $new_cont_loc); echo Third query: . $query . br /; $pg_peop_cont_ins = pg_query($query) or die(Can't execute 3rd query); When I execute the code, the page has this... First query: INSERT INTO tblPeople(fName,mName,lName, ivlweb, cnsweb) VALUES ('Frank', 'D', 'Oz', 't', 't'); Second query: INSERT INTO tblContactInformation(contactItem,contactType) VALUES ('f...@indiana.edu ', '0010') Can't execute 2nd query Actually, neither query executes. Thanks again. Carol On May 1, 2009, at 2:53 PM, danaketh wrote: Hi, you should post the INSERT query too. I'd recommend you to print the query before running it. Just put echo $query; before/after pg_query(). You'll see what are you sending to the database. This may help you find the problem. Also using ` instead of in query may help you to make it easier to read. Carol Walter napsal(a): Hello, I am very new to this process, so please forgive me if this is a silly question. I have a number of PostgreSQL tables that use the naming convention that capitalizes the first character of each word, therefor the data names require quotes. When I put together my queries using parameters for the selected columns and the table names and use pg_query_params instead of pg_query to build the query? Doing it without the parameterization looks like this... $query = SELECT tp.\peopleId\,\fName\,\mName\,\lName\, \contactItem\ FROM \tblPeople\ tp LEFT JOIN \brdgPeopleContactInformation\ bpci ON tp.\peopleId\ = bpci.\peopleId\ LEFT JOIN \tblContactInformation\ tci ON bpci.\contactInformationId\ = tci.\contactInformationId\ WHERE (\lName\ like '$l_name' AND \fName\ IS NULL) OR (\lName\ like '$l_name' AND \fName\ LIKE '$f_name') ORDER BY \lName\,\fName\,\mName\; $SciName = pg_query($query); This actually works, believe it or not, but my next query where I'm doing an insert to the tables does not. Thank you in advance for your time. Carol -- S pozdravem Daniel Tlach Freelance webdeveloper Email: m...@danaketh.com ICQ: 160914875 MSN: danak...@hotmail.com Jabber: danak...@jabbim.cz -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php