| |||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| Senior Member | connecting to db..running a query Hey i am reading an ebook on php and mysql..and here is how they teach to connect to a db: PHP Code: PHP Code: this is how they tell to run a query: PHP Code: |
| |
| | #2 (permalink) |
| Buy my domains. | If you are using multiple databases, you need to use a variable (such as $conn.) Otherwise, I don't think you need it. echo $conn; would give you an error, too. The ", $conn" in your third code doesn't need to be there. I don't know about $sql, because I'm not good at doing CREATE's in queries, but as far as I can tell, it's right. |
| |
| | #4 (permalink) |
| Buy my domains. | You'll get "Resource link identifier" or something if you try to do "echo $conn;". It's not really an error, but it's not really not an error. I don't think using the MySQL link variable into the query does anything to do unless you are accessing multiple databases. I wouldn't worry about using it in queries, however I still would give the mysql_connect() a variable. |
| |
| | #6 (permalink) |
| Buy my domains. | PHP Code: |
| |
| | #10 (permalink) |
| Senior Member | Hey I need this now..and i cant figure it out the $conn stores the user information..not the database so how do u tell it 2 use a specific database? right now i m working a script where users can make and edit databases..and 1 is the Main database that they are using almost all the time..and then there are Databases that they make/edit/delete etc.. right now to connect and run a query i have PHP Code: P.S: this is in a class..if it makes any difference |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |