FlashCreations 20 Posting Whiz

I'd suggest a simple variable that increments with each iteration of the foreach loop. With something like the code below, you can access the number of the element with the counter variable.

// +--
// | Loop through the products.
// +--

$counter = 0; //Init the counter

foreach ($prodlist as $num => $prod) {
      //Leave the below line at the top of the loop
      $counter++; //Increment the counter with each product
                  //The counter starts at 1 and counts up

      // +--
      // | Print a table row opener.
      // +--

      print '<tr class="' . $trclass . '">' . $eol . $eol;

      // +--
      // | Print the tds and their content.
      // +--

      $prodname  = $this->xhtml_encode($prod['name']);
      $prodid    = $this->xhtml_encode($prod['id']);
      $prodlink  = $this->link_namespace($app,'prodshow',$prod['id']);
      $proddesc  = $this->xhtml_encode($prod['descshort']);
      $imgname   = $prod['imgsm'];

      $add_ok = 1;

      if (($prod['useinv']) && (!($prod['invlevel'] > 0))) {$add_ok = 0;}
      if ($prod['pricestatus'] == 'D') {$add_ok = 0;}

      $quandisp = 0;
      $quanform = $this->globals('khxc_cgi.' . $formid . '--' . $prodid . '--quantity');

      if (isset($quanform)) {$quandisp = $quanform;}

      if ($add_ok) {

           print '<td class="' . $tdclass . '">' . $eol . $eol;
           print '<label for="' . $formid . '--' . $prodid . '--quantity';
           print '" class="hidden">Quantity</label>' . $eol;
           print '<input class="khxc_formfield" type="text" name="';
           print $formid . '--' . $prodid . '--quantity';
           print '" id="' . $formid . '--' . $prodid . '--quantity';
           print '" value="' . $quandisp . '" size="5" maxlength="5" />' . $eol;
           print '</td>' . $eol . $eol;

      } else {

           print '<td class="' . $tdclass . '">&nbsp;' . …
FlashCreations 20 Posting Whiz

Great! Please make sure to mark this thread as solved so other users know you don't require further assistance. Thanks :)

FlashCreations 20 Posting Whiz

Yeah I saw that and changed it but in my original code it still didn't work. But it's all good now thanks a lot!

No problem! Glad it's all fixed! :)

FlashCreations 20 Posting Whiz

Well first, there's PDFLib. It's the popular choice (it's the library listed on PHP.NET), but depending on usage, you might have to pay for it.
Some other notable choices a FPDF and TCPDF.
There are also a few HTML2PDF converters such as dompdf, but if you aren't going to use the CSS property described in my link, they kind of defeat the purpose.
If you want help with the information provided in my original link, write back and I'll explain.

FlashCreations 20 Posting Whiz

Lol because of this

$id =  $_GET['id']; //you forgot to put the $id = 

	$username = "root";
	$password = '123456';
	$hostname = "localhost";
	$db = mysql_connect($localhost, $username, $password)
	or die ("Unable to connect to mySQL".mysql_error());
	mysql_select_db('mynewdbase');

$del = "DELETE FORM newdbase WHERE id = $id";

$nres = mysql_query("$del);

?>

you should try my site it might help you better :)

It also might be useful to note that once quotes are opened, they must be closed. But in your instance, quotes aren't necessary on this line.

<?php
$id =  $_GET['id']; //you forgot to put the $id = 

	$username = "root";
	$password = '123456';
	$hostname = "localhost";
	$db = mysql_connect($localhost, $username, $password)
	or die ("Unable to connect to mySQL".mysql_error());
	mysql_select_db('mynewdbase');

$del = "DELETE FORM newdbase WHERE id = $id";

$nres = mysql_query($del); //Much better
?>
FlashCreations 20 Posting Whiz

If you create the output as a Word file, you can tell it where you want the page breaks. I don't have the details handy but if you want to go that way I can dig up some details (I have done it but I would need to dig through a program to remember how).

If your users don't mind the hassle of opening a word document, you might consider a PDF for compatibility. I know a lot of people, myself included, hate them, but there are a bunch of PDF libraries for PHP, probably a lot more than there are word document libraries for PHP.

FlashCreations 20 Posting Whiz

If you are using this code to download an image to your computer (and not a server), I would use Python instead since it is suited for server side development as well as little scripts you want to schedule on your computer.
If you would like to continue with PHP, hielo has the right idea. Although I think cURL can handle FTP if you use an FTP URL like ftp://user:pass@host:port, but I'm not sure.
On second glance I noticed that you provided us with port 22, which happens to be the port for SSH (most likely for SFTP use). If you are using SSH/SFTP, you will need to use PHP's SSH functions.

FlashCreations 20 Posting Whiz

You probably couldn't find anything because this is not a PHP specific feature. It only requires some HTML & CSS. I found this tip on adding printer-only page breaks. Is this what you're looking for?

FlashCreations 20 Posting Whiz

Props to you for using something other than MD5.
Now on to business. The basic way to validate a password stored in a database is to use a one way encryption such as SHA1. This involves hashing the password the user provides at registration and storing it in a database. To check if login credentials are valid, simply run the given password through the same hash function and compare the hashes. If the hashes are the same, the passwords match.

The code snippet you provided is not valid, nor does it validate. Please provide a better snippet that shows your problem.

FlashCreations 20 Posting Whiz

Regarding for your original code, the reason why the IP displayed but you couldn't click the link is because you were missing an = between the href and the first quote. Try this:

<a href="<?= $ip ?>"><?= $ip ?></a>

Also notice that since you have shorttags enabled I used shortened syntax to print variables. It removes the need for print or echo in short, one-line variable outputs and will be compatible with PHP (with shorttags enabled) until 6.0.0.

FlashCreations 20 Posting Whiz

If application/octet-stream works, why not use it? The only problem you mentioned is that Opera reports the file as 1.2MB instead of 1.12MB. This is probably not an error on your part. Opera usually rounds up all sizes to the tenths place so a file might be 12.56 MB but Opera will show it as 12.6 MB for succinctness. As long as the file downloads properly and reports the correct size when you view it in Explorer (as in viewing files on your computer, not Internet Explorer), why bother?

FlashCreations 20 Posting Whiz

I would have done the same, but apparently, a space alone doesn't retain the same font size as the rest of the text in the table. If all else fails, insert some dummy text and style it with visibility: hidden; .

FlashCreations 20 Posting Whiz

You can use &nbsp; as an empty space in any empty table columns and rows. It's HTML's way of representing a space. In case you haven't noticed, a space along usually doesn't work, and multiple spaces (or a new line) do no appear. &nbsp; is the answer to the multiple space (or single space alone) problem.

FlashCreations 20 Posting Whiz

mysql_real_escape_string() should be applied to any user generated content passed to MySQL to prevent SQL injections, but has no bearing on the limits on the text submitted (other than escaping characters).
The first thought that comes to mind is you aren't viewing the entire field. Try querying the DB, selecting the field, and outputting the description with PHP after inserting your description with your script. PhpMyAdmin never displays all the text if it exceeds a certain length. Usually you have to view the record individually to see the entire value of a long text field. When PhpMyAdmin truncates text, I believe it adds '...' after it to denote the truncation, but don't hold me to that.
Grab the description with PHP after inserting to verify, but I believe all the text will be there.

EDIT
Sample of using mysql_real_escape_string() to protect yourself from SQL injections, a dangerous hack that can expose and compromise data:

mysql_query("SELECT * FROM users WHERE username='".mysql_real_escape_string($_POST['username'])."' AND id='".mysql_real_escape_string($_POST['id')."'");

To grab the description, use the following:

//Conect to MySQL
//Then grab all the descriptions
$result = mysql_query("SELECT description FROM shortitem");
while($data = mysql_fetch_array($result)) {
echo $data['description']."<br>\n";
}
FlashCreations 20 Posting Whiz

what does this mean:

action="<?=$_SERVER?>"

and this:

value="<?=$data?>"><?=$data

They ( <?=$something?> ) are PHP shorttags, and can be disabled on some server configurations. They basically an easier way of typing <?php echo $something; ?> and while most don't recommend them, I will stubbornly continue to use them until their deprecation in PHP6! :)

The first one outputs the address of the page, so the form submits itself to the page that created it. The second outputs the id and name values from the MySQL database. The $data variable is set to the values from each row of the MySQL query.

@ﻼim: Thanks! Back at ya!

EDIT:
@ev Sorry about that! I didn't see that you already answered the question. :P

FlashCreations 20 Posting Whiz

:) hey there PMC.

i do also have an idea about on what baudday's asking for.
programmers have different ways in solving the same problem, right?

mine's to adjudicate first if possible, the summary of a whole program code,
and after doing so that's when I'll start giving it a shot. Ϋ

it's also my way on knowing how good the person is in terms of his or her coding.
and just so you know i guess you're one of the best already. Ϋ

:icon_wink: mabuhay ka PMC!

You have a valid point. Sometimes it is better to post code (as a rule, it's a good idea to post some for reference) and other times its not. Though, as the asker, its nicer if answers can be tailored to their exact needs. Salamat ﻼim!

baudday: If this thread has been solved, please make sure to mark it as solved so other users know that this thread does not need further clarification. Thanks! :D

FlashCreations 20 Posting Whiz

britoniah3480 has a point. MySQL doesn't limit the number of rows in a table because that is not the purpose of a database. You can assume rows are empty if they aren't set (See britoniah3480's code above).
When inserting, you can ensure that there are still spaces by doing a quick check with PHP.

//Connect to MySQL
mysql_connect($host, $user, $pass) or die(mysql_error());
mysql_select_db($db) or die(mysql_error());

//Check if there are spaces left
$result = mysql_query("SELECT * FROM players WHERE team = '".$team."'");
if(mysql_num_rows($result) < 25) {
    //Still spaces
} else {
    //Team full
}
FlashCreations 20 Posting Whiz

hi there! Ϋ

would you mind displaying a part of your code that has relation with that?
that's to solve the problem faster.

:) thanks.

If you absolutely want it from baudday, you can ask for some code, but I found that baudday's description of what he/she was looking for was sufficient to come to a solution.

FlashCreations 20 Posting Whiz

You could use ob_start() , include the file that creates the page (taking care to add any necessary GET variables to the include path as you would with a URL), and then store the contents of ob_get_contents() in a variable. Demo below:

index.php

//Start output buffering
ob_start();
//Get the contents of the dynamic page
require('dynamic.php?a=10');
//Get the contents of the page through the OB
$contents = ob_get_contents();

//To demonstrate it works
echo '$contents = ';
var_dump($contents);

dynamic.php

//Sample dynamic content
echo 'This is dynamic. A = '.$_GET['a'];

If you need to send POST variables to the dynamic page you could use cURL instead. A demo of this is below.

index.php

//Init curl and set some required  options
$c = curl_init();
curl_setopt($c, CURLOPT_RETURNTANSFER, true);
//Set the URL (w/ get variables) and any post fields
curl_setopt($c, CURLOPT_URL, 'dynamic.php?a=10');
curl_setopt($c, CURLOPT_POST, true);
curl_setopt($c, CURLOPT_POSTFIELDS, 'b=5');
//Get page contents and close cURL
$contents = curl_exec($c);
curl_close($c);

//To demonstrate it works
echo '$contents = ';
var_dump($contents);

dynamic.php

//Sample dynamic content
echo 'This is dynamic. A = '.$_GET['a'].', B = '.$_POST['b'];
FlashCreations 20 Posting Whiz

Limits are based on characters and not by words. Longtext allows for 4GB of characters, so in theory it depends on how long your words are. It is possible to have ten words that contain more characters than 100 words. But I doubt this is the case. Some possible limitations could be fontend scripts, backend trimming, and/or server limitations.
It would really help to see some code. As a rule, I would always post some relevant code unless your question involves theory.

FlashCreations 20 Posting Whiz

I know I'm kinda late to the party here, but if you prefer not to use JS (I'd use a library then like @ev said) here's the basic structure of populating a list with PHP and then returning results for that list:

<?php
//Connect to MySQL & Select DB
mysql_connect($host, $user, $pass) or die('There was an error with the database server. Please try again later.');
mysql_select_db($db) or die('There was an error with the database. Please try again later.');
?>
<!docytype html>
<html>
<head>
<title>PHP Popluate & Return Demo</title>
</head>
<body>

<form action="<?=$_SERVER['PHP_SELF']?>" method="get">

<?php $result = mysql_query("SELECT id, name FROM data") or die('Could not retrieve database information. Please try again later.'); ?>
<select name="id">
<?php while($data = mysql_fetch_array($result)): ?>
    <option value="<?=$data['id']?>"><?=$data['name']?></option>
<?php endwhile; ?>
</select>

<input type="Submit" name="action" value="View">
</form>


<?php if($_GET['action'] == 'View'): ?>

<?php if($result = mysql_query() && mysql_num_row($result) > 0): ?>
<table>
<thead>
    <td>ID</td>
    <td>Name</td>
    <td>Field1</td>
    <td>Field2</td>
    <!-- etc. -->
</thead>

<?php while($data = mysql_fetch_array($result)): ?>
<tr>
    <td><?= $data['id'] ?></td>
    <td><?= $data['name'] ?></td>
    <td><?= $data['field1'] ?></td>
    <td><?= $data['field2'] ?></td>
    <!-- etc. -->
</tr>
<?php endwhile; ?>

</table>
<?php else: ?>
<p>No results could be found for the given id</p>
<?php endif ?>

<?php endif; ?>
</body>
</html>
FlashCreations 20 Posting Whiz

Well it would take a little more work than that if you wanted true security. Slightly advanced authorization should look something like this. You should also look into MD5 Salts.

<?php
mysql_connect($host, $user, $pass);
mysql_select_db($db);

//If id & session are set validate them
if(isset($_COOKIE['id']) && isset($_COOKIE['session']) {
    $result = mysql_query("SELECT * FROM users WHERE id='".mysql_real_escape_string($_COOKIE['id'])."' AND session='".mysql_real_escape_string($_COOKIE['session'])."'");
    //Go to login page if id or session is invalid
    if(mysql_num_rows($result) == 0) {
        header('Location: login.php');
        exit();
    }
    //Regenerate session id
    $session = md5(mt_rand());
    if(mysql_query("UPDATE users SET session='".$session."' WHERE id='".mysql_real_escape_string($_COOKIE['id'])."'")) {
        setcookie('session', $session);
    }
} else {
    //Otherwise send to the login page
    header('Location: login.php');
    exit();
}
?>
FlashCreations 20 Posting Whiz

Well you'll need to find a way to get the short code SMS to communicate with your PHP script. I have no idea how to do this. When it comes to the PHP, it seems easy enough.

switch(strtolower($_GET['command'])) {
    case 'pizza':
        $r = mysql_query("SELECT * FROM pizza ORDER BY popularity DESC LIMIT 5");
        if(mysql_num_rows($r) != 0) {
            while($arr = mysql_fetch_array($r)) { echo $arr['name']; }
        } else { echo "No pizzas found. Sry!"; }
        break;
}

This would work assuming you have already connected to your database and your table structure is similar to my little demo. You would also need to have texts to the number routed to your script, assuming the command parameter contains the contents of the text and the stdout is returned to the sender of the text message.

FlashCreations 20 Posting Whiz

The basics of a user system involves three main parts.

  1. Registration - The user provides details such as desired username, password, and email. Some verification should be done to make sure that the user names and emails are unique to that user. If they are, insert this information into a users table of your database. This table should include a unique ID, username, password (encrypted with the md5() function, a one way hash), email, and session id. As an extra layer of security and to prevent spam you can filter for valid emails and send email verifications to ensure users give you valid addresses.
  2. Authentication - The user provides login details such as username and password or email and password. The username/email should be checked against the database. If it does exist, run the given password through an md5 hash to verify that the passwords match. From here, store the unique user id and a random session id as cookies on the users browser. To validate login, check to see if the unique id stored in the cookie matches a record in the table along with the session id. You can regenerate the sessionid for maximum security.
  3. Management - Something as simple as PhpMyAdmin can be used for user administration. You can update, delete, and add users with little to no extra work. If you prefer a more targeted admin panel, you can add advanced options that includes all of the above and other features such as banning by …
FlashCreations 20 Posting Whiz

Assuming that the downloads are routed through a PHP script, it should be simple enough to record user download data. The devil is in the database and how you store this information. Here's my recommendation:
You only need one table to store download information along with hit counts. I recommend three columns for tracking download numbers: A total downloads column, a weekly downloads column, and a monthly downloads column. When a user requests a file download, simply increment all three fields for that file by one.
You stats are simply a MySQL query away:

//Get total downloads
mysql_query("SELECT downloads FROM files WHERE id='".$id."'");

//Get weekly downloads
mysql_query("SELECT weeklyDownloads FROM files WHERE id='".$id."'");

//Get monthly downloads
mysql_query("SELECT monthlyDownloads FROM files WHERE id='".$id."'");

*Depending on what you name your columns

You will need CRON jobs to run once every Sunday and once at the end of every month. The weekly script should contain something along the lines of:

//Set all the files to a 0 weekly download count for the new week
mysql_query("UPDATE files SET weeklyDownloads=0");

As you can assume the monthly CRON will look something like this:

//Set all the files to a 0 monthly download count for the new month
mysql_query("UPDATE files SET monthlyDownloads=0");

**These all assume that you have already connected to MySQL and a DB, and perform the necessary mysql_fetch_array() 's after if the query requires it.

Cheers,
PhpMyCoder

phplover commented: Fantastic post made in helping me :) +1
FlashCreations 20 Posting Whiz

*Cringe* Please, please, please mysql__real_escape_string() any user given value before using it in a query. Without doing so you are putting yourself at high risk of SQL Injection!

Now on to your problem. I would check the query (it seems you've outputted it out as a comment) on the second line and verify that there isn't anything wrong with it.
It would be a tremendous help if you could provide us with the value of $_GET['id_proiect'] or the final query that produces this error.

FlashCreations 20 Posting Whiz

Yeah, the MVC usually doesn't vary between frameworks; you only have to get used to the little quirks (such as CI Models) and extras. If your ambitious enough, you could design your own framework (something I've been working on as a side project), but thats a lot of work compared to downloading & learning CI!

FlashCreations 20 Posting Whiz

Thanks Steve!
It is a great framework, though I am embarrassed to say that I haven't worked with it that much either. :D
Someone on the PHP form has to be a CI guru. If there isn't and vizz has a question about CI, I guess we have some reading to do...
-PhpMyCoder

EDIT: It's been so long since I've been on Daniweb, I almost forgot how strange the smilies looked!

FlashCreations 20 Posting Whiz

If I may add my ten cents, I believe that CodeIgniter.com has a great 20 minute tutorial on creating a basic blog. Not sure if you consider CI "a feature", but its a great way to create applications without having to worry about internals. This way you can learn the structure and required parts before you have to dive in and start from scratch. You can use some of the models ardav described and implement them in CI as a starting point. After you understand how everything fits together, then move on to starting from scratch.
If you are one of those dive-in-and-try-it people, then by all means, disregard the above and take a shot at it. Post any questions you may have here or in a new appropriate thread.
--
For the purists out there, I'm not endorsing CI as a start to PHP. I believe it's much better to learn and be comfortable with PHP basics & OOP before using a framework. In this case, I think a framework could help illustrate relationships and basic functionality.

All the Best,
PhpMyCoder

FlashCreations 20 Posting Whiz

EDIT: No need to be rude LRNPHP. We're trying the best we can to help. If you didn't think you'd get help with your question, why did you post in the first place? All of us are volunteers here. Please respect that!

If you want a new window, I suggest looking into JavaScript's window.open(). It's ugly, outdated, and sometimes doesn't play nice with pop-up blockers, but it's what you asked for. Gunnarflex has a better solution for this as modal windows are much more elegant than pop-ups. You might also benefit from a neat trick such as replacing the original search box with several ones prefixed with refined options.
If this is not the solution to your problem, can you please explain your question. Exactly what are you looking for? I think we satisfied the need of the pop-up/modal window you asked for. Would you like help with the actual advanced search page?
We're not mind readers here! ;)
Help us help you.

Best,
PhpMyCoder

FlashCreations 20 Posting Whiz

Something like this will have to be achieved with a combination of AJAX and PHP. The frontend (JavaScript) will call your backend (PHP) with a request when a new name is selected from the list. At its most basic form, that would like something like this:

<?php
//If a name was requested
if(isset($_GET['name'])) {
    //Connect to MySQL and select DB
    @mysql_connect($dbHost, $dbUser, $dbPass) or die('{result: -1');
    @mysql_select_db($db) or die('{result: -1}');
    //Get details on person via MySQL query
    $result = @mysql_query('SELECT data FROM person WHERE Name="'.mysql_real_escape_string($_GET['name']).'" LIMIT 1');

    //Return an error if person wasn't found
    if(mysql_num_rows($result) == 0) {
        die('{result: 0}');
    }
    //Otherwise, return user details
    $person = mysql_fetch_array($result);
    die('{"result": 1, "data": "'.$person['data'].'"}');
}
?>
<!doctype html>
<html>
<head>
<title>Person Information</title>
<script>
document.onload = function() {
    var x, details = document.getElementById('details');
    document.getElementById('pSelect').onchange = function() {
        if(window.XMLHttpRequest) {
            x = new XMLHttpRequest();
        } else {
            x = new ActiveXObject("Microsoft.XMLHTTP");
        }
        x.open("GET", "<?=$_SERVER['PHP_SELF']?>?name="+escape(this.value), true);
        x.onreadystatechange = function() {
            if(this.readyState == 4) {
                response = eval('('+this.responseText+')');
                if(response.result == -1) {
                    details.innerHTML = '<em>There was an error with your request.</em>';
                } else if(response.result == 0) {
                    details.innerHTML = '<em>Person was not found</em>';
                } else {
                    details.innerHTML = response.data;
                }
            }
        };
        x.send();
    };
};
</script>
</head>
<body>
<p>Person: <select name="person" id="pSelect"><option name="Bob">Bob Doe</option></select></p>

<div id="details"></div>
</body>
</html>

I've combined the backend and frontend into one file, but you can just as easily separate them if you wish. The JavaScript can also be sped up with the help of a library such as JQuery. Of course, …

FlashCreations 20 Posting Whiz

Maybe try nl2br() on the code:

<?php
include("contentdb.php");
include("data.php");
 
$display = mysql_query("SELECT code FROM $table ORDER BY id", $db);
if (!$submit)
{
       echo "Code:"
        while ($row = mysql_fetch_array($display)) {
        echo "<br><b>".nl2br($row['code'])."</b><br>";
        }
}
?>
FlashCreations 20 Posting Whiz

Actually funny enough, he does have some sort of security in place. The tag <iostream> was removed because of it's containing < and > (which generally signifies an HTML tag). What needs to be done though, is not stripslashes or addslahses. It's mysql_real_escape string():

<?php
include("contentdb.php"); //Connect to MySQL
include("data.php"); //Declares Variables
//Perform query
if(mysql_query("INSERT INTO $table (code) VALUES ('".mysql_real_escape_string($code)."')")) echo "<br><br>Your Code  was Added to the Quiz.<br><br>";
?>
<a href="editquizlist.php">Return to the Code List</a>

To really diagnose the problem, we would need to see the data.php file. Can you post it?

FlashCreations 20 Posting Whiz

There is no shorter way to ensure that several fields aren't blank in SQL, but you could write a PHP function to make it slightly easier:

function selectWhereNotNull($fields, $table, $where) {
    //Init Query
    $query = "SELECT ";
    //Append fields to Select
    if(is_array($fields)) {
        $query .= implode(", ", $fields);
    } else {
        $query .= $fields;
    }
    //Append table to select data from
    $query .= " FROM {$table} WHERE ";
    //Append IS NOT NULL for each statement
    $statements = array();
    foreach($where as $field) {
        $statements[] = "{$field} IS NOT NULL";
    }
    $query .= implode(" AND ", $statements);
    return(mysql_query($query));
}

Usage:

$query = selectWhereNotNull(array("fields", "to", "select"), "table", array("fields", "that", "are", "not", "null"));
FlashCreations 20 Posting Whiz

Please use the code tags in future posts to enclose your code in. :)

You can say that again!

To check for a valid AID, try querying for all records with that id and then counting the number of rows returned:

$result = mysql_query("SELECT AID FROM Employeeinfo WHERE AID='".mysql_real_escape_string($aid)."' LIMIT 1");
if(mysql_num_rows($result)==1)
  //Valid AID
else
  //Invalid AID

The problem regarding the empty textboxes has to do with the fact that their respective values can't be found in POST (unless you passed them to the page through a POST Form). You need to query the Database for their values and insert them instead.

FlashCreations 20 Posting Whiz

The problem is with your MySQL. Try quoting the values you are inserting. Also, on a side note, instead of using session you could use hidden inputs to pass the required values to form_process.php. Though it won't make much of a difference, substituting another technique in place of session saves you some (Very little, except on servers that serve millions of users) space since values are stored on the server.
One other thing: Why are you passing the value of a terms and conditions box to MySQL? It seems unnecessary since if the user doesn't agree to the TOS, then they won't be added, but again, your choice.

EDIT:
While I think about it: It looks like you are handling credit card numbers in your script. If I'm not mistaken, it is illegal in most countries to transmit a credit card number over HTTP. Are you using HTTPS?

FlashCreations 20 Posting Whiz

Inside a complex syntax brackets ( {$var} ) you can call any function with a return value that can be converted to casted to a string. So using your code that would be:

$message .= "<td>XXXX-XXXX-XXXX-{substr($_GET['cc_number'] , -4, 4)}</td>";

//Or this....
$message .= "<td>XXXX-XXXX-XXXX-".substr($_GET['cc_number'] , -4, 4)."</td>";

//Or even this...
$message .= "<td>XXXX-XXXX-XXXX-";
$message .= substr($_GET['cc_number'] , -4, 4);
$message .= "</td>";

The first or second ones make most sense to me, so I would chose one of them, but it's totally up to you!

drewpark88 commented: Helped me alot! +1
FlashCreations 20 Posting Whiz

What you are looking for is file writing/reading operations. For this you use fopen along with the w parameter which tells PHP you want to write to the file (and create it if it doesn't already exist).

$name = $_GET['name']; //Or where-ever you get the file name
//Sanatize
$name = str_replace('\\', '', $name);
$name = str_replace('/', '', $name);

//Open the file
$f = fopen('safedir/'.$name.'.php' , 'w');
//Write to the file
fwrite($f, "Hello World! Your code or HTML should go here.");
//Close file
fclose($f);

//Next, redirect to the new file
header("Location: safedir/{$name}.php");
FlashCreations 20 Posting Whiz

Then append the search variable to all of the pagination links. If the keyword is what's missing, also append this and add a snippet at the top to get the keyword from the URL like this:

if(isset(@$_GET['keyword']) $keyword = $_GET['keyword'];

If your code is still throwing notices like this when you allow users to access it, I would suggest turning error reporting off...

error_reporting(0); //Turn off all errors
error_reporting(E_ALL ^ E_NOTICE); //Allow fatal errors, but mute notices, this is the default setting for most PHP installations

If you do hide errors from users, but still want to be able to see them yourself, you can set up an errorlog file. Suppressing problem functions with @ will also work too as long as you don't have any surprise problems.

FlashCreations 20 Posting Whiz

No that's perfectly correct, I just had a little trouble understanding you. So with that in mind, the links to other pages should include the search parameter. I don't know where the $keyword variable comes from, but it also should remain constant throughout the pagination.

FlashCreations 20 Posting Whiz

Without having an internet connection. Wouldn't that defeat the purpose of writing a PHP script. You could use localhost and maybe XAMPP or LAMP, but without an internet connection. Why?
If you insist, you could always try a CSS graph like I had suggested before. It's not as elegant as the Google API and its sure not as easy, but it doesn't need an internet connection (It does need a browser, though!)

FlashCreations 20 Posting Whiz
i think you arenot pass searching  text for every page. you are passing only start veriable only. check once

What?

FlashCreations 20 Posting Whiz

It is possible with JavaScript and the Google API or a CSS chart (again updated by JavaScript constantly polling a server page. This server page will echo data to the AJAX request and you can update your table there)

FlashCreations 20 Posting Whiz

Just a note:
When you find the number of pages, you want to find the ceiling (or highest integer) of the division since 1.5 of a page is actually two.

$pages = ceil($item_count / $per_page);

Also, does the error message (notice) given you a line number?

FlashCreations 20 Posting Whiz

Well there's SWF charts that rely on XML files for data. You could make the XML file dynamic with PHP and have the SWF poll the file every fifteen seconds or so. XML/SWF Charts would be an option for this.

The other way, would be with Javascript and CSS. Sometime ago I read an article about creating graphs in CSS. I'll look for it and post back when I find it.

EDIT:
Here's the link: Pure CSS Graphs

FlashCreations 20 Posting Whiz

Alright, it's done! You can download the demo from: http://files.phpmycoder.net/da0110v

FlashCreations 20 Posting Whiz

Oh ok, I get it now! What you need to do is just use the $dbroomno variable after the puzz_ like this:

if($puzzleNum<7 && $puzzleNum>0) { 
  mysql_query("SELECT * FROM user_info WHERE id = '".$_SESSION['userid']."' AND puzz_".$puzzleNum." = '". $dbroomno);
}
FlashCreations 20 Posting Whiz

If anyone has any ides this would be amazing as it would save me having to write an if statement for each puzzle.

Daryll

Since there are multiple puzzles, a switch statement would probably be a better option (It's a bit less than an if, but I guess you could use If/Else if you really had your heart set on it).

As for your MySQL, I'm not quite sure what you want. You talked about puzzle tables, yet your SQL has another table in it. What's $dbroomno ? What's Puzz_whatever ?

FlashCreations 20 Posting Whiz

Well it looks like the link to images on your index doesn't work. It sets type=Images, but for some reason, with no results. To diagnose this problem, I will need to see your code for index.php. If you don't feel comfortable posting it on the forum, you can PM me. I'll try to do my best at fixing the issue with the different search types.

EDIT:
I will not disclose them here, but I have noticed several extreme security loopholes in your system. If you would like I could also look into these and help you fix them.

FlashCreations 20 Posting Whiz

Why not pre-load some data instead of using AJAX. It makes much more sense to me, but if you insist, have you checked out W3SChools AJAX tutorial?

Here's a little demo of what you're looking for:

function getPopulation(country)
{
  ajax = getAjax();
  if(ajax)
  {
    ajax.onreadystatechange = function() { alert(country."'s population is ".ajax.responseText); }
    ajax.open("GET", "population.php?country=".country, true);
    ajax.send(null);
    return true;
  }
  return false; //Browser doesn't support AJAX..possibly fall back to hard-coded numbers
}

function getAJAX()
{
  if (window.XMLHttpRequest) return new XMLHttpRequest();
  else if (window.ActiveXObject) return new ActiveXObject("Microsoft.XMLHTTP");
  else return false;
}