Jump to content

allworknoplay

Members
  • Posts

    385
  • Joined

  • Last visited

    Never

Everything posted by allworknoplay

  1. Well of course you can, but this is basic HTML 101. So say you have a mysql record: $row[link]; You would just do this: <a href="$row[link]">IMAGE</a> Then if you want to also show a link, it's the same thing: <a href="$row[link]">$row[link]</a>
  2. LOL... Agreed....
  3. Yup and since we're dealing with unix timestamp, you can use PHP's time function. $now_time = time(); Put the $now_time into the table when the user joins a certain group.
  4. Create a separate file called dbconnect.php Put this in your dbconnect.php file. <?php function db_connect() { Global $host, $username, $password, $dbname, $link_id, $table_name; $host = "localhost"; $username = "xxxxx"; $password = "xxxxx"; $dbname = "xxxxx"; $table_name = "xxxxx"; $db = mysql_connect($host,$username,$password); if (!$db) { echo "connect: mysql_error()"; exit; } $select_db = mysql_select_db($dbname,$db); if (!$select_db) { echo "select: mysql_error()"; exit; return ($link_id); } } ?> Now in your main program include the dbconnect.php file. include_once("dbconnect.php"); $link_id = db_connect(); Now run your function: function viewSpecialsUi() { $link_id = db_connect(); $bd_string = "<ul>"; $sql = "SELECT id, date, date_added, title, image FROM $table_name ORDER by date_added"; $result = mysql_query($sql) or die(mysql_error()); $num = mysql_num_rows($result); } Now do me a favor and just fill in $table_name manually just to get the whole process working. Then we can work on passing that variable over to the function....
  5. Fine, you really want to encapsulate? Give me 1 minute and I will tell you exactly what you have to do.
  6. Dude, stop messing around with variables, let's just get your query to work. Statically fill in what table_name you want!! $sql = "SELECT id, date, date_added, title, image FROM [b]MYTABLENAME[/b] ORDER by date_added"; You can make it a variable later after it works...
  7. Ok well try this now... // database connection function dbConnect() { Global $connection; <---add this make it global $db_name = "xxxxxxxxxx"; $connection = mysql_connect("localhost", "xxxxxxxxxx", "xxxxxxxxxx") or die(mysql_error()); $db = mysql_select_db($db_name, $connection) or die(mysql_error()); $table_name = "xxxxxxxxxx"; return ($connection); <---add this }
  8. LOL that was easy... Mark as SOLVED please!! =)
  9. Right ok, make a change to your DB function, use this: // database connection function dbConnect() { $db_name = "xxxxxxxxxx"; $connection = mysql_connect("localhost", "xxxxxxxxxx", "xxxxxxxxxx") or die(mysql_error()); $db = mysql_select_db($db_name, $connection) or die(mysql_error()); $table_name = "xxxxxxxxxx"; return ($connection); <---add this }
  10. hmm.... function viewSpecialsUi() { $connection = dbConnect(); $bd_string = "<ul>"; $sql = "SELECT id, date, date_added, title, image FROM $table_name ORDER by date_added"; $result = mysql_query($sql, $connection) or die(mysql_error()); $num = mysql_num_rows($result);
  11. Hey where do you think you are going? Where's the code?? Just kidding....good luck...
  12. Easy, you just need to have a column in the user table or in another table that shows a timestamp of when they became part of the "members only" group... So really, instead of looking at when they JOINED the forum, you just simply look at when they became part of the Members group....
  13. Yup, I saw that, it's probably WAY over my head right now. Once I pass my PHP cert, I need to jump on my redhat cert which I kinda put on hold to do the PHP cert... I think it would be a great idea to get Zend framework cert though....I don't really see employers asking for Zend certifications yet but it doesn't matter, these certs are for me and to help shore up my knowledge....
  14. haha you guys are crazy!! The original poster hasn't even come back to this thread and you guys have all these ideas and code for him...LOL.. Props to you guys!!!
  15. Is that even a valid way to create an array? I've never seen it done that way before..
  16. echo "$_SESSION['pass']";
  17. He declared the array earlier: $array = array(); Do you think he still has to do this? $array[]
  18. I may come to you from time to time as I learn this framework. I hope you won't mind.... I have my PHP certfication test that I need to take in about 2-3 weeks. Once I get that out of the way, I can hit the Zend framework full throttle...
  19. Can we see your arrays?
  20. Great write up! Thank you, I definitely appreciate anyone taking the time to explain this stuff to me. I've decided to go with Zend without much more research from CakePHP and the other one, Sympfony. Maybe that's not a good idea but I will have to have faith that the people at Zend are going in the right direction. Sometimes you just have to pick one and run with it....or you can go back and forth forever one a framework and never get good at either one of them..... I don't mind the learning curve, I'll take it on full throttle... Thanks for the write up!
  21. LOL....my spider senses tell me has no PHP code...
  22. Ummm this belongs in some SQL DB forum...
  23. That's because you don't have any statements for it!! Use this... <?php $querye = "SELECT * FROM `events` WHERE `evcategory`='cultural' and val='true' and `evcity`='$city' and `country` = '$country' ORDER BY dateofevsearch ASC"; $resulte = mysql_query($querye) or die(mysql_error()); $checkifex = mysql_num_rows($resulte); while ($postede = mysql_fetch_assoc($resulte)) { $eventname = "{$postede['evname']}"; $eventid = "{$postede['eid']}"; $eventsubcat = "{$postede['evsubcategory']}"; if ($checkifex != 0) { echo"<table align= 'left'>"; echo "<tr><td align='center'>$eventname $checkifex<br>"; echo"</td></tr>"; echo"</table>"; }elseif($checkifex == 0){ echo"<table>"; echo "<tr><td>There are no results at this time</td></tr>"; echo "</table>"; } } ?>
  24. You said if a row doesn't exist..sooo...? You can do an IF on this.. if($checkifex == 0) { //do something }
  25. It's pretty easy, just do a little research on setting up cron jobs on our linux server. I assume you are using linux? Then the cron will kick off your PHP program. You are going to need to know how your DB is designed in order to make the correct adjustments to your users.....
×
×
  • 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.