I am trying to allow users to sort mysql queries based on name, price, etc. This drop down gives them the power to do that, it changes the "ORDER BY" clause based on what the user chooses. It's 3am here and I just can't spot the mistake:
<?php
$sortBy = $_POST['sortBy'];
if ($sortBy) {
$priceLowToHigh = ...
We're currently designing a rewrite of our PHP website. The new version will be under SVN version control and have a separate database for development and live sites.
Currently we have about 200,000 images on the site and we add around 5-10 a month. We'd like to have these images under SVN as well.
The current plan is to store and ser...
hi. it may sound stupid, but i want to know how (if possible) to count from 0 to 10 by a sql command. i mean i want a sql query which produces one column consisting of numbers from 0 to 10, like this:
0
1
2
3
4
5
6
7
8
9
10
i'm currently using MySQL 5.0
...
I am working with a CMS system, and using a kind of smartform am inserting fields into a table.
In these fields are the name of a product, quantity and cost.
cost and product name are taken from a products table, while quantity is input manually.
I understand this is not the best architecture, but I am limited with the system I am wor...
Basically I am using the MySQL gem for Ruby, and I have no reasonable support for date comparison. The Mysql::Time class only gives me only accessor methods like year, month, second, etc. I could do much better date comparison, if I could turn this into a Ruby DateTime object. How can convert MySQL's DateTime field to a Julian day number...
Is there something special about characters that should be allowed/not allowed in a password?
I store the password in the db hashed/salted and use PDO to prevent against injection. Is what I'm doing enough? Recently I came across a system that disallowed a number of characters, don't remember all of them, but one was the ampersand &. W...
Hi Guys,
I have a website that displays a table of a list of people and a value of 1 or 0. If the value is 0 the cell background is green, it ifs 1 its red. How would i make it so clicking the cell will change the value (and therefore colour) and write it to the database?
Below is my code.
Many thanks,
Stephen
<?
include("dbinfo.inc...
I am having trouble counting the number of rows until it reaches a certain PK.
My PK is called id and I want to count all rows until i reach a specified id
I have tried using this query but it doesn't work probably becuase I am using a MySQL table
select max(count(*)) from news where id=18 group by id
I get this error
Invalid us...
I want to create a textbox (for entering names) in my aspx application which suggests names of Employees from database.
I am pasting my code below. I am using Mysql
Default.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxC...
I just realized that there is no best way to hide MySQL string connection password in my executable file, especially in JAR file. Even encrypting it in EXE would only slow down the process (although I'm not sure how much time would it take to get an encrypted password from an EXE file).
So, from my understanding, I need something in th...
This is a follow on from another question i made
I have this query that counts all the records up to a certain point i choose whcih works fine
SELECT count(*)FROM news WHERE id < 18
this query gives me a count of 7
I am now having problems with the offset which would be the result of the above query
I tried using this query
SELECT...
I have set up a small script to handle a page where I have three checkboxes.
The HTML for the checkboxes looks like this:
<input type="checkbox" value="Ex1" name="Check[]" />Ex1
<input type="checkbox" value="Ex2" name="Check[]" />Ex2
<input type="checkbox" value="Ex3" name="Check[]" />Ex3
And the PHP script for these:
if($_POST['Che...
I'm trying to do
SELECT * FROM a, b
However, it doesn't return anything if one of the tables is empty. How do I make it so it returns 'a' even if the other one is empty?
...
I'm changing my database structure and I want to do the following thing: I have one table for registered users that holds almost all the information about my site users. There is also one other table that holds information about the amount of points each user have. It has only two columns: user id and points. I want to move the points co...
If I use Tigase(xmpp server demon) on my server (not distributing it) and build custom plugin(stay within server). Do I have to release my source codes? What if my website have google adsense and If I build some commercial usage plugs for tigase for my own website use. I have no clue how GPL license work for software which we don't distr...
This is a bit of a difficult problem for me to word, and I may be going about it in the completely wrong way.
I'm storing a set of options in a database, where each option is its own column. The user can change the number of options, however, so I need a way of allowing PHP to always select all the options.
Let's say I have these colum...
Hi,
I have a textarea field that's inserted into a mysql database which may contain line breaks. The textarea data has accidentally gone through two lots of mysql_real_escape_string functions. Therefore the line-break bit of the field data is now stored as "\r\n" instead of an actual new line, as it's been double escaped?
Now when writ...
Hi There,
I have two tables, timetable and lesson_booking these are linked via timetable_id.
timetable represents timetable entries for a given day (mon, tue etc) that can be selected and used to make a booking for a client in lesson_booking
What I would like to do is get a list of timetable entries that have no bookings associated w...
I've been doing a lot of parsing of webpages lately and my process usually looks something like this:
Obtain list of links to Parse
Import list into database
Download Entire Webpage for each link and store into mysql
Add Index for each scraping session
Scrape relevant sections (content, metas, whatever)
Steps 4,5 -- Rinse/Repeat -- as ...
I start a transaction.
Then I need to rollback it.
Can I somehow get a list of the queries that get "discarded" this way?
(ps: of course I can log them beforehand; I was wondering if this could be done in a more "natural" way)
...