john010117
Members-
Posts
492 -
Joined
-
Last visited
Never
Everything posted by john010117
-
How to display a certain image, depending on a variable.
john010117 replied to Kemik's topic in PHP Coding Help
Ok, then. So first, get the data from the database. Then, using the code I've posted above... <?php // I'm assuming you've already made the db connection and have executed the query... // Substitute the row name while($row = mysql_fetch_array($result)) { echo '<img src="/images/' . $row['lang'] . 'flag.gif">'; } // blah... ?> -
http://www.phpbb.com/ ... or simply search it on Google...
-
How to display a certain image, depending on a variable.
john010117 replied to Kemik's topic in PHP Coding Help
Yes, there is a way. First, name all of your image files the same way (ex: LANGflag.gif) and they should all be in the same folder. Then when you display it, just use <?php $lang = $_GET['lang'] // (or however you get your user's language) echo '<img src="/images/' . $lang . 'flag.gif">'; ?> -
Heh, I'd look into phpBB's lang source code. They have it in arrays, but you'll have to download additional language packs.
-
Did you put session_start() at the very beginning of both files?
-
First of all, I suggest you put session_start() at the beginning of login.php. Then, in logout.php, you have to start the session first, then destroy it.
-
$query = "SELECT rank FROM `ranks` WHERE id IN(" . implode(',', $rankid) . ")"; $result = mysql_query($query) OR DIE (mysql_error()); Putting it in variables is sometimes easier.
-
It'll be better if you posted the relevant part(s) of the code here, as I am not going to click those links. However, have you looked at array_merge() ?
-
Try this: $result = mysql_query("SELECT rank FROM `ranks` WHERE id IN (" . implode (',',$rankid) . ")");
-
What exactly were the errors that you got?
-
We're here to help, not to make the entire thing for you. Try to get started on it first, and we'll be glad to help you along the way.
-
Put <?php error_reporting(E_ALL); ?> at the very top of the page. See if any error message comes up.
-
That worked! Thank you all so much for helping me out with this.
-
I don't really get what you mean by the question, but the field "msg_id" is the same in both tables. I'll try that out.
-
Nevermind. You started the session already ($_SESSION['username'] = $username). I overlooked that before. Sorry. Solution: check_login.php: <?php session_start(); mysql_connect("localhost", "root", "xxxxxxxx"); mysql_select_db("xxxxxxxxxxxx"); $username = $_POST['username']; $password = $_POST['password']; $sql = "SELECT * FROM users WHERE username = '$username' AND password = '$password'"; $result = mysql_query($sql); if (mysql_num_rows($result) == 0) { echo "Username and password combination not found."; } else { while($row = mysql_fetch_array($result)) { $_SESSION['username'] = $row['username']; } header("members.php"); } ?>
-
Since I'm dealing with multiple tables, that wouldn't work.
-
You didn't start $_SESSION['username'] in check_login.php...
-
That just deletes ALL of the records. I believe I need the limit in there.
-
DELETE privmsgs, privmsgs_spec FROM privmsgs, privmsgs_spec WHERE privmsgs.msg_id IN (4,5) LIMIT 2
-
[SOLVED] A closing echo in include() file?
john010117 replied to joemamahunt's topic in PHP Coding Help
File 1: <?php // Blah Blah include ('file2.php'); ?> File 2: (the include file) <?php echo '<td></td>'; echo '<td>'; ?> You don't really have to use PHP in the include file... <td></td> <td> -
@ roopurt18: I got this error: My query now looks like this: <?php $query = "DELETE $privmsgs_tbl_name, $privmsgs_spec_tbl_name FROM $privmsgs_tbl_name, $privmsgs_spec_tbl_name WHERE $privmsgs_tbl_name.msg_id IN (" . implode(', ', $_POST['pm_delete']) . ") LIMIT " . count($_POST['pm_delete']); ?> Any ideas? @ Hypnos: I'll try it out.
-
Try $_POST['check']['1'] or maybe $_POST['check'][1]
-
Will this work with deleting rows from multiple tables that I have now? They all have the same ID as their common row.