Jump to content

Multiple mysql queryes?


Voorm

Recommended Posts

I did script,looks ok to me,at least i still didn't got any error at my localhost.

And i need be sure is script ok,to i can continue peacesfully.

Script reading from mysql and shows in page,to i be precise,it only show in midle,there's used print for head and for footer html codes and midle is reserved for mysql for each page (5-6 should be),it shows by id.

Anyway,will be nice if someone check my code and say if im in good way or not.I worry about so many queryes,i don't know if should be like that or not.This are 3 files,connection and default.php & second.php

<?php$host = "****";$user = "****";$pass = "****";$db = '*****';$conn = mysql_connect("$host", "$user", "$pass") or die ("Unable to connect to database."); $defaultpage = mysql_query("SELECT * FROM $db.default WHERE id='$id'");$secondpage = mysql_query("SELECT * FROM $db.sec WHERE id='$id'");$thirdspage = mysql_query("SELECT * FROM $db.thrd WHERE id='$id'");$fourthpage = mysql_query("SELECT * FROM $db.fourth WHERE id='$id'");mysql_select_db("$db", $conn);?>
<?phpinclude 'pages_t/page.php';$self = $_SERVER['REMOTE_ADDR'];if($_GET['id']){$id = $_GET['id'];} else {header("Location: default.php?id=1");}print $firstchild;print $secondchild;include 'conf/connect_to_mysql.php';while($rowdefault=mysql_fetch_array($defaultpage)){$id = $rowdefault['id'];print $rowdefault['default'];}print $thirdchild;?>
<?phpinclude 'pages_t/page.php';$self = $_SERVER['REMOTE_ADDR'];if($_GET['id']){$id = $_GET['id'];} else {header("Location: second.php?id=1");}print $firstchild;print $secondchild;include 'conf/connect_to_mysql.php';while($rowsecond=mysql_fetch_array($secondpage)){$id = $rowsecond['id'];print $rowsecond['second'];}print $thirdchild;?>
Edited by Voorm
Link to comment
Share on other sites

  • 2 weeks later...

Ty for answer.I fixed that with queryes.

There's one more thing i wish to know.

I seen google's robots.txt and i made same style for my project.

I wanna know if i did it corectly.this is just example.

 

robots.txt

User-agent: *Disallow: /confDisallow: /css_scriptsDisallow: /imagesDisallow: /java_scriptDisallow: /pages_tAllow: /?id=Sitemap: http://localhost/sitemap.xml

sitemap.xml

<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><sitemap><loc>http://localhost/map.xml</loc></sitemap></sitemapindex>

map.xml

http://localhost/default.php http://localhost/default.php?id=1 http://localhost/default.php?id=2 http://localhost/default.php?id=3

Did i'm made good whole thing,also i'm not sure for 'Allow: /?id=' if i did corectly.

Link to comment
Share on other sites

There's not much of a reason to list specific things to allow. By default everything is allowed unless you disallow something. Also, don't put links to localhost online. Localhost points to the computer you are currently using, so those files are not available online. Upload your site map and point to that URL.

  • Like 1
Link to comment
Share on other sites

  • 2 months later...

Well i used some free hostings to test whole thing,whole thing worked perfectly.

Now i brought domain name,for verry low money,and conrtol panel is Parallels,and i got problem...

It shows "Server Error 403 - Forbidden: Access is denied. You do not have permission to view this directory or page using the credentials that you supplied."

Can't see website,and can't see php files if there exist any code,but when is empty i can open in browser.Other files i can open with np.

 

To say truth,i have no idea how to fix this,i spended about 5 hours to figure out where i did mistakes and nothing.

Any suggestions?

:sorry:

Link to comment
Share on other sites

might want to check your info, also contact your web host to make sure you have permission to create a datebase and view your directory, but according to that message it seem like you might have misspelled something

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...