Maq
Administrators-
Posts
9,363 -
Joined
-
Last visited
-
Days Won
3
Everything posted by Maq
-
Try echoing them in the if else statements to see if you're even getting there. Another thing is that you have this, which is nothing: $uid = $id; then you have this, which will always return because $id is never set to anything: if (!$uid) return; //should validate here
-
You don't need a new connection for each function so only call the connect DbConnector() method once. Once you connect, you're connected, and should be able to invoke any method in that class successfully.
-
nah just kidding It's taken anyway... although the following are available: doughnation.info doughnation.tv doughnation.me doughnation.mobi doughnation.biz
-
I meant as far as indentation and spacing. It's very poorly formatted in that sense.
-
lol, what, did you just buy the domain name right now?
-
It's right next to where it says, "Enter Command"...
-
Haha that guy is a load of crap. He does bring up some convincing points about the illuminate but if you research him he also claimed to be, "the son of God"...
-
Straight from DarkWater's regex tutorial:
-
Hmm yeah, file uploading scripts can be tricky sometimes.
-
Change this line to: </pre> <form method="post" action="siggyscript.php"><
-
And you can clear your cookies. What exactly is this for?
-
I don't know what you're trying to ask here. But for the format you're trying to do for the date should look like this: $date = date('Y/m/d'); echo $date; ?>
-
No offense, but you should also consider formatting your code, it's nearly impossible to read and will make detecting errors a whole lot easier.
-
EDIT: Read the question wrong, cookies is what you want.
-
I prefer TIMESTAMPS, makes everything easier.
-
And you're positive GetCatsList() is a method of the class wsCore? Are you properly using the switch statement, breaking in and out? You may want to read switch. Besides that I'm not really sure, cause you're giving us 2 separate errors with different code.
-
Some things to note: If you comment out the mysql stuff (connection, select_db, and mysql_query) it will print out the query that you would hypothetically be using. I've attached another file, I guess it would be your "i.php" file. The difference here is that I added a button where you can destroy your session and refresh the page, so you can try different things. log.php) session_start(); //connection information mysql_connect("localhost", "username", "password") or die(mysql_error()); echo "Connected to MySQL "; mysql_select_db("statistics") or die(mysql_error()); echo "Connected to Database"; // Getting the information $ipaddress = $_SERVER['REMOTE_ADDR']; $page = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; $referrer = $_SERVER['HTTP_REFERER']; $datetime = date('D, M j, Y (T) \a\t h:i:s A'); $useragent = $_SERVER['HTTP_USER_AGENT']; $remotehost = @getHostByAddr($ipaddress); $_SESSION['stats'] = (isset($_SESSION['stats'])) ? $_SESSION['stats']+1 : 1; if($_SESSION['stats'] > 1) { //they refreshed the page... don't do anything echo "We've already stored your stats..."; } else { //it's their first time here; INSERT into the database $sql = "INSERT INTO statistics (ipaddress, referrer, datetime, useragent, remotehost, page) VALUES ('$ipaddress', '$referrer', '$datetime', '$useragent', '$remotehost', '$page')"; mysql_query($sql) or die(mysql_error()); echo "Successfully recorded your stats: $sql"; } ?> i.php include "log.php"; echo "OK we're here"; if(isset($_POST['submit'])) { session_destroy(); echo "Session Destroyed..."; } ?> </pre> <form action="<?php%20echo%20%24_SERVER%5B'PHP_SELF'%5D;%20?>" method="POST"> < Hope this all works for you.
-
Please read up on your MySQL Date functions. You're using them incorrectly. There are examples in the link I provides that are similar to yours.
-
[SOLVED] Confused as to how to go about an insertion
Maq replied to cbear2021's topic in PHP Coding Help
You need to normalize your tables... should be 3 tables here pitch ---------------- pitch_id pitch_name pitch users ---------------- user_id user_name pitch_id users_to_pitch ---------------- users_id pitch_id So now you can relate pitch.pitch_id to the users table pitch_id. Now for inserting into the DB... When they upload the pitch, put it in the pitch table. pitch_id should be an auto-increment. Then when you go to add to the user_to_pitch table you can use mysql_insert_id(); to grab the last inserted id of the pitch. So in the user_to_pitch table you would be inserting: $pitch = mysql_insert_id(); $id = $_SESSION['id']; $sql = "INSERT INTO users_to_pitch (user_id, pitch_id) VALUES ('$id', '$pitch'); Hope this makes sense and helps. -
Change this line to and tell me if you see any errors when you try to insert again. $query = mysql_query($sql, $connect) or die(mysql_error()); You are also missing a '}' from your first if statement.
-
[SOLVED] Confused as to how to go about an insertion
Maq replied to cbear2021's topic in PHP Coding Help
When they login just store their username in a SESSION variable so when they upload a pitch you can just do: echo "submitted by user : " . $_SESSION['user']; Does this answer your question? -
Sure no problem. Please mark as [sOLVED]
-
No functions in PHP are not case-sensitive. Being a Java developer, I tend to do the same thing. I believe this style of naming is referred to as CamelCase.
-
How to return a page when data is not found in a table?
Maq replied to kisazeky's topic in PHP Coding Help
if$num == 0) { header('Location: ../not_found.php'); } else { //code to proceed } -
Hehe good idea Andy-H