Jump to content

scrubbicus

Members
  • Posts

    112
  • Joined

  • Last visited

    Never

Everything posted by scrubbicus

  1. So I'm curious how it works with PHP and MySQL. Will I be ranked just as high organically if I'm generating my content through dynamic PHP and functions as well as pulling information from MySQL databases rather then having all the content in plain HTML? If yes how does that work, if no how can I make it work since I'm sure all of the larger websites are using such a system. For a quick example. Would these all work the same in terms of search engine visibility? <title>Hello Website Nice to Meet You <title><?php echo 'Hello Website Nice to Meet You'.$_SESSION['name']; ?></title> class meta { private $_title = 'Hello Website Nice To Meet You'; public function getTitle() { echo $this->_title; } } <title><?php $meta->getTitle(); ?></title> Ya know and so on...
  2. $thiscolcats = ($col > $longcols) ? $percol_short : $percol_long; What does that ? and : mean? For some reason I think it's a shorthand way of doing and ifelse.
  3. "SELECT * FROM $t_countries c INNER JOIN $t_cities ct ON c.countryid = ct.countryid AND ct.enabled = '1' WHERE c.enabled = '1' GROUP BY c.countryid $sort1"; So I'm configuring another application to suite my needs and I came across this crazy statement. I'm really only familiar with the basics (INSERT, DELETE, UPDATE, LIMIT, ORDER BY, AND), anyone have a good website that would explain these for me? They certainly look like they could help a lot.
  4. It won't let me grab the value I'm trying to grab $_POST['email'] in this instance but I'm using a dynamic form that passes the key that was edited through $_POST['key'] which I do $key = $_POST['key'] (so now if email was edited $key = 'email' and then the value comes through $_POST['whatever value it was'] which I try to catch like this $value = $_POST[$key] but it says that index 'email' does not exist. but I can do this $value = $_POST['email'] and I can echo $key. so both of those are valid but the whole $_POST[$key] doesn't work. any help is apprecieated thanks.
  5. so i have a search thing that's included into the page and it's using the method of get so i can transfer that value through some odd pages. ive tried a few things in order to get the URL to stay the same because I need the information on the URL as well but the GET method is destroying the url. ok so my url is going to be at all times index.php?page=$_GET[$global] when i send the get form it does this index.php?query= or query= I need the $_GET['page'] superglobal in order for my website to work I've tried a few things on the actual form for what the action does like action="index.php?page=$_GET[$global]&" action="&" action="?"
  6. Well no it wouldn't be on seperating hosting it would all be on the same host in the same MySQL just different databases. So I could connect to any of the databases through a simple mysql_select_db() but do I want to be selecting databases throughout my script or should I just use the same database for all the websites?
  7. So I'm going to be making a network of websites and each of these individual websites I will want to use some of the same tables. I'm wondering if I should make one database for all the sites or make seperate databases for each website and then a database for all the information that each website will share. I've never tried to connect to two databases before I'm just curious which method will be best to approach something like this. Each website won't have that many tables so if I used one database it won't be super large.
  8. So I'm have a problem using variables and functions all that jazz in all my functions and classes. So I have this class that I want to call in a function that's outside that class. Also does anyone have a good tutorial website that's mainly focused on organizing classes and functions to get best results? My code is pretty jumbled I have a lot of functions in one large class and I'm starting to see that maybe every function that doesn't have to do with another function should be its own function and then everything that can use something else should be in a class.
  9. I was looking for a way to encrypt the password that's put into a database when a user signs up then whenever they're going to log back in I can decrypt it to check it against the password they entered. I've been looking for a way I stumbled across md5 a lot but there were dozens of mixed opinions on whether it was one-way and your never getting back the original string or there is a way to decrypt it but no one was saying how. Any help appreciated. Thanks.
  10. Oh crap your right I could have just done that... so I'd probably do a foreach loop on my array and then use a string function to search for 'select' and if the strpos() returns true make that array item another string. Thanks. I also have one more question that just arose. Is there anyway through PHP to grab all $_POST globals that were submitted and put them into a string or array without directly asking for them?
  11. So I'm trying to create a dynamic form and what I need to do is this for instance. Here's the array [0] => 'name', [1] => 'email', [2] => 'select(day-sun-mon-tues-wed-thurs-fri-sat)' What I want to do is to grab [2] out and put it as a string. However I don't want to have to do this $day = array[2]; I want to be able to search the array for characters in this instance would be select and then once it find the characters select it would pull that array item out and I can then make it a string.
  12. I'm trying to set something up on my site to show all users currently online. I tried looping through my database and checking if $_SESSION['username'] == $row['username'] then echo 'Online' but only works for me being online. So I'm thinking of adding a column to the users table for online/offline and whenever someone logs on it updates that too online then logs off it updates it too offline. Is this the best way or is there another way? Thanks.
  13. http://scrubbicus.com/simplebudget/index.php Then I have a page called verify.php that is probably just as messed up and that page is completely dedicated for verify information and inserting data and such. It's a whole page of elseif()s that check for a $_POST global that all my forms have in the hidden input field each one is different. Once it finds one through isset($_POST) then it continues on either verifying information or inputting table information when it's done it header redirects back to the original page.
  14. So I developed some online thing on my computer and the PHP on my webhost is definitely different then that on my computer but the headers are being sent way to many times and it worked flawlessely on my computer but now it's all kinds of fucked up. I use header(Location:)s alot through the script for redirecting. At the beginning of my index.php I include my class file that starts a session as well as calls the main class, then after that on index.php if $_GET['page'] isn't sent then it redirects. That's all the headers on those pages then I have every other header on a page that does not have any of the HTML template just PHP code to verify certain things then when verified to redirects back to the original page with a message in a cookie that displays on the page. I'm not very good with headers apparently but any suggestions on how I might approach this kind of thing and fix what I got now?
  15. I'm slowly getting the hang of OOP but I think I'm still using the entirety of it wrong. Currently I'm making everything in one huge giant class and defining all the definite private variables in that class the I can use them throughout. My construct for that class is the MySQL connect and MySQL select db and I call this class at the beginning of index.php. $initialize = new initAll(); then I just make all my functions and variables in that class through the script I feel like I'm definitely not using OOP correctly and capitalizing on parent/child relationships which I haven't really gotten to yet because when I do it becomes a hassle for me to call functions and variables from different children, from the parent, or from classes entirely different.
  16. right i typed that wrong but ill use that query string thanks. it is 'username'
  17. Hey so I two columns one named 'name' and the other named 'aid'. (aid = account id) I'm trying to check to see if a user exists under an account ID because I can't have duplicate users in the same account ID but i certainly can have same usernames in different account IDs. So i was trying SELECT * FROM members WHERE username='$username' and aid='$aid' also SELECT * FROM members WHERE username='$username', aid='$aid' but neither work
  18. So I'm trying to create an ORDER BY for all four columns in my table (name, price, date, and category) three out of four are ordering the way I want them to but price is ordering by the first highest numerical digit rather by then how many total digits there are. So $6 is higher then $2000 in this case and $10000 is lower then both of them. How would I go about ordering the price column by highest and lowest?
  19. These two tables are not related to each other. One is where all the articles are posted and the other is where I store all my content information for the different pages. I just want to be able to SELECT ALL from each table preferably a different column name for both but I can definitely change the column name so that the 'content' column is the same for both. So I'd be selecting two different tables with a column that has the same name.
  20. What's the best way to make variables global so that absolutely everything can access it? Right now I currently have my variables files required on index.php so that every file can access it but I'm trying to access some of those variables from within my classes and they can't find those variables. I've also tried requiring onload off my main initialize class that variables file but then anywhere I call that variable outside a class it can't find it.
  21. I have enabled them but it's not giving me any errors it's just not looping through the displaySubmit() Forgive the PHP structure. It's my first try at trying to make a fully dynamic website. I'm trying to make the second version of my website to be kind of like a CMS. I figure developing one of those would throw a bunch of new challenges at me.
  22. Okay here's the whole class <?php class form { private $_results; public function __construct($form) { $this->_results = mysql_query("SELECT * FROM forms WHERE module='$form' ORDER BY id ASC"); } public function displayForm() { $count = '1'; $num_cols = '2'; echo '<div id="div_form">'; echo '<form method="post" action="#">'; while($row = mysql_fetch_array($this->_results)) { echo '<div id="div_form" class="column'.$count.'">'; if($row['type'] == 'text') { echo '<div class="form">'; echo '<div class="form_header">'.ucwords($row['name']).'</div>'; echo '<div class="form_field"> <input type="text" name="'.strtolower($row['name']).'" maxlength="'.$row['maxlength'].'" /> </div>'; echo '</div>'; } elseif($row['type'] == 'select') { echo '<div class="form">'; echo '<div class="form_header">'.$row['name'].'</div>'; echo '<div class="form_field">'; echo '<select name="'.strtolower($row['name']).'">'; $parameters = explode(',',$row['parameters']); foreach($parameters as $i) { echo '<option name="'.$i.'">'.ucwords($i).'</option>'; } echo '</select></div></div>'; } elseif($row['type'] == 'textarea') { echo '<div class="form">'; echo '<div class="form_header">'.ucwords($row['name']).'</div>'; echo '<div class="form_field"> <textarea name="'.strtolower($row['name']).'"></textarea> </div>'; echo '</div>'; } if($count == $num_cols) { $count = '0'; } $count++; echo '</div>'; } echo '<div id="form" class="submit"> <input type="submit" name="submit" value="Send E-Mail" id="button" class="email" /> </div> </div>'; } public function checkForm() { while($row = mysql_fetch_array($this->_results)) { $value = $_POST[strtolower($row['name'])]; $field = strtolower($row['name']); if($field == 'category') { if($value == '-- Select One --') { die('<b>Please choose a category</b> <br /> Hit back on your browser.'); return false; } } elseif(empty($value)) { die('<b>Please fill out all required fields</b> <br /> Hit back on your browser.'); return false; } } } public function displaySubmit() { echo '<p class="header"> Thank You, '.$_POST['name'].' </p>'; echo '<p class="message">Thank you for submitting your e-mail. We will get back to you as soon as possible. You\'ll be receiving an auto-response. You may want to check your <b>spam</b> box it\'s been known to end up there.</p>'; echo '<p class="header"> Sent E-Mail Message </p>'; while($row = mysql_fetch_array($this->_results)) { echo '<b>'.ucwords($row['name']).':</b> '.htmlentities(mysql_real_escape_string($_POST[strtolower($row['name'])])).'<br />'; } } }
  23. So I have an e-mail form that I'm creating $form = new form('contact'); if(!isset($_POST['submit'])) { $form->displayForm(); } else { if($form->checkForm() == NULL || $form->checkForm() == true) { $form->displaySubmit(); } } So I have that to call the functions and I don't want to have to copy and paste everything in the function but within each of the functions is this loop. while($row = mysql_fetch_array($this->_results)) { } I first had this problem when I tried to generate the sent message but I fixed that by create an isset and !isset for both the form and the sent message. Now I'm trying to error check the form by looping through my table to get the $_POST form names then check if any of those are empty() and if nothing is empty then nothing gets returned false so displaySubmit() can be called. It does get to that but it doesn't generate the sent message because I'm guessing the checkForm() is already using that instance variable and looping it.
  24. So I should use UNION or JOIN I'll look up those commands on the MySQL website and learn more about those.? Are those the only two ways I can do what I'm trying to do?
×
×
  • 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.