Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Everything posted by ginerjm

  1. I think you are looking for 'variable variables'. Check the manual out here: http://php.net/manual/en/language.variables.variable.php
  2. And considering that this is a php script that is not on the server, the response is always controlled by the connection speed and server response time (load?). Your concern about an array retrieval might be more pertinent if this was a JS problem rather than PHP
  3. Completely off the wall guess here but if php is telling you a function does not exist, then I would say you do not have it enabled in your installation. You said it is enabled but what confirmation of it do you have? Try doing a function_exists call perhaps.
  4. I have no idea what this 'escape' function does so I cannot offer any help. And your edit attempt really doesn't accomplish anything here. Adding parens is meaningless.
  5. Underscore, not dash. mysqli_query Also - as I said in your other post - you can't mix MySQL and MySQLI functions. Change your connection logic
  6. It may sound right when you say it in English but in code one must repeat each condition completely and NOT make the assumption that you do when you speak it. and (keywords like '%$skey%' or keywords like '%$bname%') and category like '%Mycategory%'"; (Note the set of parens too) PS - this is not PHP btw - it is sql
  7. You need to find the name of the object that is created by a successful login and then reference that in you Hello thingie. Something in the form of: $(objectname)->user I think.
  8. Does that code actually run? (do you have error checking turned on? Try: $usrsql = "SELECT * FROM $tbl_name WHERE username='$username' AND password='$password'"; $usrres = mysql_query($usrsql); if (!$usrres) { (handle query failure situation) exit(); } if (mysql_num_rows($usrres) > 0 die("Username is already taken!"); else (handle no username situation)
  9. Looking at the partial code of your class try this: if $user is defined as public in that class, then you should be able to reference $user for the current object, whatever that is. Your initial code shows you trying to grab something using $user but $user is a property within the object so it's a bit confusing. Did you make up that code?
  10. I would think that none of that would show if the user is not logged in. Also why an anchor tag to display a value? You want people to be able to click their name? Maybe try this: if (isset($user->data()->username) && $user->data()->username <> '') echo 'Hello ',$user->data()->username; else echo 'You are not logged in'; I have no idea what the data method is doing but I'm taking a guess here.
  11. Without seeing your code how do you even think we can help you? I can only guess that when you verify the login (with a db query?) that you are not pulling in the username as part of that query. Include it in the validation check query and then set a local var and echo that out when the time comes.
  12. while ($row = $query->fetch(PDO::FETCH_ASSOC)) { echo $row['headline'],'<br>'; } Also - you shouldn't do a "select *' query when all you really want is just the one column.
  13. Well, you do have some errors in your code, but the usual solution would be to set the row's background color. Add this to your tr tag <tr class='$bkgrnd'> Then in your style section of your html code add two classes: .color1 {background-color:white;} .color2 {background-color:lightgray;} In your loop now check the value of your data and set $bkgrnd to either 'color1' or 'color2' depending upon what you want. Note: you are missing the closing row tag on your headings. Also - you should look at the odbc_fetch_array function instead of using the odbc_result one that you are using. Your method is very resource intensive (ie, inefficient). Using the fetch_array function will get all your values in an array and you can use those elements in your output loop. Check the manual for examples.
  14. Your insert doesn't reference the id column. Is that column an auto-increment one? Otherwise I think you need to specify all the columns when doing an insert.
  15. Differentiated? Whatever do you mean? Like a key? Add one! Do not create multiple tables to separate your records. That's like building a library to store one book.
  16. Something about your solution is flawed. Why would you design a database structure that makes you create a whole new table for a set of data? You defeat the whole purpose of having a well-organized database that facilitates the storage and ready retrieval of your data. Assuming that the sets of data each time refer to the same entities then putting those sets of data into separate tables is ridiculous. How would you ever write a query to find a specifici set of data(aka, row)? I urge you to re-think your db design here.
  17. Great! As I said originally - we help with coding. Show us the code you have a problem with and you'll surely get help with it. Of course if you don't have any code, then I'd still call that a 'design problem'.
  18. Why don't you show us that then instead of just saying it. And what exactly does "do not work" imply? Do you have error checking turned on as noted in my signature?
  19. Like I said - the table name you used is wrong. Either you are in the wrong db for that table name or you are referencing the wrong table.
  20. Please post your code in a more readable fashion and properly.
  21. What does your script do? Where does it go wrong? Try putting in some messages to help you see the path it is taking.
  22. No thanks. We help people with coding problems (at least that's what I try to do). Not with doing research for your design issues.
  23. 1 - It means your query failed. Since you checked the connect and the select that means you probably specified the table name incorrectly in your query statement. 2 - You should cease and desist from using the MySQL_* functions. Period. Read the manual for any one of these functions and see why.
  24. No - it doesn't sound easier at all. What the heck are you describing? You want to "send parameters to (a) remotes sites form"? What does that mean? And what makes you think you can do that? Are you using their API? Or are you just trying to spoof their form and submitting data from your own script? You want to "Receive information/failsafe". What does that mean? You want to display data. Sure - that's easy. Just echo it out. Perhaps you can be a little more expansive in your goals and help us to help you.
  25. So? Use some formatting in your output of the data. You began a table and defined all the headings but then you didn't output any columns to correspond to those headings. Do you have an html resource that you use? Then use it to learn how an html table is built.
×
×
  • 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.