Jump to content

gizmola

Administrators
  • Posts

    5,231
  • Joined

  • Last visited

  • Days Won

    77

gizmola last won the day on September 23

gizmola had the most liked content!

2 Followers

About gizmola

Contact Methods

  • AIM
    gizmoitus
  • Website URL
    http://www.gizmola.com/

Profile Information

  • Gender
    Male
  • Location
    Los Angeles, CA USA

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

gizmola's Achievements

Prolific Member

Prolific Member (5/5)

228

Reputation

20

Community Answers

  1. I have come to the conclusion, he wants us to run his code, test it and debug it. The language barrier is also probably contributing to it. I looked at the code, which is pretty simple. It might actually work, if the database is available. Probably there is a database connection problem, and OP is just not seeing the error messages as gw1500se suggested helpfully in an earlier post, might be remedied with error_reporting and possibly turning the errors on during development.
  2. You have described pretty much every database application that has paginated lists of data. Rarely do you see these features built with sprocs. To add briefly to requinix's comments: I believe the default mysql engine now is InnoDB. Make sure you are using the innodb engine for your tables. You want them to be InnoDB tables. InnoDB has a true data cache component, so not only will the query be cached, but the actual result set will be cached. You can configure the amount of server memory allocated to the cache. Ideally you can achieve a high percentage of cache hits in a properly resourced server, so that data is repeatedly coming from cache rather than having to be pulled from persistent storage, although with the proliferation of high performance SSD's, reading from disk is less an issue than it used to be, but is still something that you should aspire to, even if it's just extending the lifetime of your SSD's. I have nothing against sprocs, but it sounds like a lot of overkill for this project for very little gain.
  3. One of the several advantages to using prepared queries is that you don't have to escape special characters. Since you are using mysqli_ * api: Quick example from this Mysqli guide, that is well worth reading through... # replace your php parameters in the VALUES section with '?' for each column you are inserting $sql = "INSERT INTO users (name, email, password) VALUES (?,?,?)"; # Now prepare the statement. It is ready for binding. $stmt= $conn->prepare($sql); #bind the values. The first parameter is a type for each column. 's' is for a string. 'i' is for integer. 'd' is for double/float. 'b' is for binary/blobs $stmt->bind_param("sss", $name, $email, $password); $stmt->execute(); Another thing that is beneficial is that once you bind variables, you can simply set them to new values and do another execute.
  4. No worries, this is why the forum exists -- to help people who are working on things, and giving an honest effort, which you clearly are. Glad you are not giving up.
  5. Look at the stuff Barand highlighted in yellow. Here's the first one: <div class="div-table-row" 'text-align: right;'> So what is the problem here? Well you have a css class you are referencing, which is good. Then you have an inline style: 'text-align: right;' Really you should avoid using inline styles, and have your own style sheet you reference in your page, however, if you wanted to do this, the problem is that you are missing the attribute name and equal sign for the inline style definition. <div class="div-table-row" style="text-align: right;"> Also try not to mix your quoting style. For html, best practice is to use double quotes for all attributes. The 2nd problem he highlighted is the same as the first. You have a set of inline styles, but no style=".....".
  6. Also to answer your question, a common technique is to use a hidden form element, if you need to pass an extra attribute that isn't part of the 2 you have in the drop down. You would need a bit of javascript to set it onChange. <input id= "catId" type="hidden"> With that said, you should probably use the cat_id rather than the category to index the select. *edit* See Barands comment ^^^^^^^^
  7. Just going forward, while these type of all in one functions with data & presentation are enticing (and I certainly wrote many of them back in my early days of web development) it's really an anti-pattern that you should avoid. Have a function that returns the data in a format, ideally json, but at very least in a clean php data like an array. Why json? Because it will be easier for you to wire it into a javascript based UI. In the meantime for server side coding, have a separate view script or template. You might organize these by putting them into a subdir named /views or /templates. You could write a simple render($view, $data) function that takes the parameters and require_once() your $view. At that point, your view templates can just concentrate on html, and using alternative php syntax, handle whatever looping you need.
  8. Things like this, with interleaving batch processes also have a propensity to suffer from race conditions. In your case it sounds like you have a form of a race condition, where separate processes interfered with your expectations of how things would work from a timing standpoint. Sometimes the best tool for something is one that already exists. The entire process that copies from linux1 -> linux2 could be done using rsync, and its "--remove-source-files" option. The command would be: rsync --remove-source-files -options /path/to/src/ linux2host:/path/to/dest This is not a criticism of what you built, but just pointing out that if the only reason you have a drive NFS mounted on linux1 is to facilitate this copy process, then rsyncing would decouple the servers, and also likely be a lot more efficient, allowing Linux1 and Linux2 to each do what they were designed for independently. NFS has a good deal of network overhead intrinsic to it, and this copying process is likely producing a lot of network traffic that you don't need, just maintaining state and doing NFS locking. NFS is great when you truly do need to share a filesystem across a number of different servers, but for a 1-1 mount like this, rsync would be better, and is also famous for its high level of performance in copying or syncing files.
  9. I browsed through the code. Did you write this code? Is it from a Tutorial? I don't understand why something new would use Bootstrap 2.0.1, which is a 7 year old version of Bootstrap. I did not find the error messages you provided in your first message. Are these really the error messages that occurred? Without the exact messages, we can't pinpoint where that code is running from.
  10. Post with portions of your problematic code using the code button. We don't allow people linking to archive files, as they could literally contain anything.
  11. Agree 👍. Gotta use Double quotes around strings in Json. -> Spec Here. Scroll down to String. Embedded double quotes have to be escaped with a backslash.
  12. You can call json_last_error() to see what the parser said.
  13. Not clear what you are asking for here, but either way, we need to see some code.
  14. Because in the POST example, you are actually doing an HTTP POST request that goes to a new page. This is why I suggested you look at the network tab, so you can see this in action. In the 2nd (all javascript) you don't actually leave the page, you just run javascript code on your existing page.
×
×
  • 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.