Jump to content

Recommended Posts

I tend to put that sort of information at the top of my page after the headers.

Defines the variables for the rest of the page that way.

So you'd have it look like this:

[code]
<?php
// get parameters from the URL into the page and sanitise
if (!empty($_GET['industry'])){
  $ind_id = strip_tags(add_slashes($_GET['industry']));
}

// call the file that has my DB connect code in it
include('connect.php');

// setup the SQL statement with the variable from the url
$sql = "SELECT * FROM tablename WHERE industry = $ind_id";

// execute the statement
$result = mysql_query($sql);

// Check it executed ok
if (!$result){
  die ('There was an error executing the SQL: ' . mysql_error());
}

// Do something with the results
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){
  echo "$row['columnname']<br>\n";
}
?>
[/code]

Regards
Huggie
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.