-
Posts
471 -
Joined
-
Last visited
-
Days Won
8
Everything posted by dalecosp
-
$myArray = array(); foreach (range("a","z") as $letter) { $x=1; while ($x<1001) { $myArray[] = $letter.str_pad($x,4,"0",STR_PAD_LEFT).str_pad($x,4,"0",STR_PAD_LEFT); $x++; } }
-
At registration, test a version of the proposed username with the spaces removed against the database. If it exists already, advise that the username is already in use and the user should select another.
-
It looks like you need to read this: http://www.bioinformatics.org/phplabware/internal_utilities/htmLawed/htmLawed_README.htm and either set up or modify an array called $config at the top of whatever PHP file is processing the HTML. HTH,
-
I'm afraid I can't help based on that alone. For example, what does "It does not work" mean? Do you see a blank page in the browser? Do you receive an error message? Do smoke pour out of the server and choke the SysOp? And, ouch, die() as your only error handler? I guess that depends on some other factors ... if it's in house or development only, that's a quick and dirty way to handle the failure, I guess. To help you with debugging, how about something more like? foreach($_POST['mid'] as $key=>$val) { $percent = $_POST['percent']; $detail = $_POST['detail']; $qty = $_POST['qty']; $rate = $_POST['rate']; $sql = "UPDATE val_mworks SET mworks_percent = '$percent[$key]', mworks_detail = '$detail[$key]', mworks_qty = '$qty[$key]', mworks_rate = '$rate[$key]' WHERE mworks_id = '$val' "; $result = mysql_query($sql); if (!$result) { echo "MySQL Query Failed! SQL was : $sql MySQL said : ".mysql_error(); die(); } }And if that doesn't get you any answers, I'd check logs and possibly open a ticket with your host? (Assuming you have a hosting service, of course).
-
"free of cost" So, how will you be recompensed for your effort? By the knowledge you gain? That's valid, but you can't eat it, of course. At least, not *yet* I'm a big advocate for flow charting on paper. And not even so much flow charting at first, as just drawing pictures and writing important concepts in such a way that I can visualize a problem domain. If you don't have experience designing databases, I'd read up on that. It can make a big difference in how your application will work later. Do you need classes? Well ... I don't know ... have you ever written "OO" code? I typically find that "OO" code is fine if I think that I'm working with something that can be objectified ... and perhaps your problems can. Rooms could be objects, floors could be objects, and so on. But it may not be absolutely necessary to do it this way, and if you have little experience with it, it may make things more difficult. But get out your paper and pencil first ;-) My $0.02,
-
I can't remember the last time I used the "main" page ... have the manual pages changed as well? They look the same to me so far ...
-
That's normal. The cookie is placed in the browser's cache, but since the page has already been loaded, the cookie wasn't present at page load. Since you already know the "name", put it in another variable ... it will be usable there.
-
I have an application that reads the Internet and makes "data widgets", that is, representations of things it has read. Part of the application inspects these "data widgets" and assigns various bits of metadata to each one ... a "category", a "source", and so on. The next step to to move these widgets from a local server to a server on the West Coast. But rather than loop through this entire process, making a connection to the remote box each time, we pack up each "data widget" using serialize() and put it in a DB table which serves as a queue for the next step. The final step reads the DB table, loops through the results, unserialize()ing them back into their original object form, and pushing them out to the West Coast server. Does that help at all? You serialize() data in order to store it more concisely (the holding queue is 3 fields, while the object itself, if stored in a database, has a few dozen fields). You unserialize this data blob to turn it back into a usable object.
-
Hmm ... a couple suggestions, maybe. Try getting rid of the delete on each pageload and just write an admin script to run from cron every two hours. Are you just running reverse chronological chat? "Select * from some_table" is usually overkill. If you only want, for example, to show the most recent conversation, would something like "select time, chat_text from chat_table order by time desc limit 20;" work ?
-
I'd even go farther and say it's a problem with database design, or application design overall. But nothing's every quite perfect, is it? ginerjm makes some sense ... so you have too many rows ... just show the other info once and each photo in turn. Another thought, which might be expensive, is to do one query for the car data and a second query for all the photos; put them in an array and handle this array in your PHP logic. You generally would prefer to not hit the DB multiple times, but if you can't change the design of the data, you can change the design of the queries.
-
Are you looking for text *along with* an image, that is, printed text near the image, or printed text *on* the image, as in a watermark? For watermarking, you need to get into the gd_ functions.
-
Email upload confirmation code help
dalecosp replied to danielwilliamsongle's topic in PHP Coding Help
It would really help anyone who seriously wants to help if you would post the code as it exists right now, and the exact error message... -
I'm sure you're not Pathetic, Sam. The only parse error in what you've posted is 1] the lack of the opening PHP declaration, and 2] the "pointer" which should be a comment: If the parse error you quoted: is really what the server/debugger tells you, then you didn't cut and paste the code exactly as it exists in the problem installation....
-
What does your debugger say? (F12, man, F12!)
-
To elaborate a tad further, you often see this: select `something` from `someplace` where `some_condition` = 1234;Those are "backticks", and people that use them use them in order to make sure that their SQL server, (MySQL in this case, and especially) doesn't choke on any terms. For example, you can use a reserved word as a column name, but only if you enclose it in backticks. I tend NOT to use them, and to (properly, I believe) refrain from using SQL Reserved Words as column names. HTH,
-
+1. Explain your data and perhaps someone can give you a good layout for a real *relational* database. Having a table for every user is a big no-no.
-
Re-read my first post, it's been edited ... I flew off the handle a bit too soon, and that would cause the second error.
-
And, actually, you'll probably want something besides "Oh noes, an error!" --- either debugging information (if you're in development), or a proper error handling routine if not.
-
Check for $result before you call mysqli_fetch_array. It's apparently returning false. $result = mysqli_query($connection,"SELECT * FROM ".$myusername."-mail ORDER BY date ASC"); if ($result) { while($row = mysqli_fetch_array($result)) { echo "done"; echo "<br>"; } } else { echo "Oh noes, an error!"; }
-
Welcome to PHPFreaks! (From another "newbie" who's really not-so-new)
-
Why not just do it with Javascript? <script type='text/javascript'> window.open = function() { return; } </script>A dysfunctional function!
-
Your first and second Pastebin links both go to the sidebar template; neither links to the jQuery script. What does your PHP script send as a response to the Ajax ... "ok", or "failed"?