MySQL Query changes on existing PHP / JS Page

I have a complete PHP, MySQL, JS POS package which prints tickets.

I need the following changes made to the programming:

1) - The MySQL has a database of events (Table called "eventslist"). Only one event can be active at any time. However if there are no active events the code currently throws errors.


Write some PHP/JS/MySQL code to ensure there is always an "Active" event so the errors don't throw. Or if Active event does not exist, write values to PHP Variables to indicate there is no active event.

**CURRENT MySQL Queries**

$sql = "SELECT eventdate FROM eventlist WHERE eventstatus = 'Active'";

$select = $db->prepare($sql);


$activeeventdateSQL = $select->fetch(PDO::FETCH_ASSOC);

$activeeventdate = $activeeventdateSQL['eventdate'];

$activecorrectedeventdate = date("l d F Y", strtotime($activeeventdate) );

$activeeventdateforlookup = date("Y-m-d", strtotime($activeeventdate) );

$actualusername = ($_SESSION['username']);

// Lookup Active Event Host

$sql = "SELECT hosttrack,eventname FROM eventlist WHERE eventstatus = 'Active'";

$select = $db->prepare($sql);


$activehosttrackSQL = $select->fetch(PDO::FETCH_ASSOC);

$activehosttrack = $activehosttrackSQL['hosttrack'];

$activeeventname = $activehosttrackSQL['eventname'];

// Lookup Active event Pricelist to use

$sql = "SELECT assignedpricelist FROM eventlist WHERE eventstatus = 'Active'";

$select = $db->prepare($sql);


$activepricelistSQL = $select->fetch(PDO::FETCH_ASSOC);

$activepricelist = $activepricelistSQL['assignedpricelist'];

$sql = "SELECT eventsponsor FROM eventlist WHERE eventstatus = 'Active'";

$select = $db->prepare($sql);


$activepricelistSQL = $select->fetch(PDO::FETCH_ASSOC);

$eventsponsor = $activepricelistSQL['eventsponsor'];

Taidot: PHP, MySQL, Tietokannan hallinto, Tietokantaohjelmointi

Näytä lisää: how to speed up mysql queries in php, javascript mysql query, how to execute sql query in javascript function, using jquery ajax and php to fetch data from a mysql database, ajax php mysql search example, how to fetch data from database in javascript in php, fetch large data mysql php, ajax php mysql

Tietoa työnantajasta:
( 4 arvostelua ) Lenah Valley, Australia

Projektin tunnus: #21291204

Myönnetty käyttäjälle:


Hello, This should be a StackOverflow question actually. Here, I'll help you : in the code you have pasted (lines 4 and 5) $activeeventdateSQL = $select->fetch(PDO::FETCH_ASSOC); $activeeventdate = $activeeventdateSQ Lisää

$20 AUD 7 päivässä
(12 Arvostelua)

13 freelanceria on tarjonnut keskimäärin 33$ tähän työhön


Hello How are you? I read your job description carefully and interested. I have 8+years experience in php and related stuff. I'm sure I can complete your project high quality Lets discuss more details over chat Kind Lisää

$35 AUD 1 päivässä
(219 arvostelua)

Sir, I have gone through your project description and am looking to provide my service for query bug fixing. please leave a message on my chat so we can discuss the budget and deadline of the [login to view URL] more than 7 ye Lisää

$30 AUD 1 päivässä
(157 arvostelua)

Hi, I have done this before but I have a few questions, can we chat please? I have 10 years of experience in PHP.

$65 AUD 7 päivässä
(54 arvostelua)

I believe in providing good quality code and services with security. I am a Web Security Researcher & Bug Bounty Hunter at HackerOne, BugCrowd, BountyFactory and many other Independent Bug Bounty Programs Reported Sec Lisää

$50 AUD 1 päivässä
(70 arvostelua)

Hello client. I am working on IT field for 7 years. I have rich experience of developing web sites and have great skill with MySQL query. Also I have been done convert data structure. So I am sure I can do your job per Lisää

$23 AUD 1 päivässä
(23 arvostelua)

Hi I understood the query what you written and I can rewrite to support and remove the error thrown by the mysql and I can fix this quickly and send it call me in chat. Thanks

$20 AUD 7 päivässä
(4 arvostelua)

I have knowledge of mysql, database, php. i can fix this isssue as you say.

$25 AUD 1 päivässä
(2 arvostelua)

Hello!!! I'm pretty happy to bid on this interesting project. I read your description carefully and I think that I am the developer you are looking for and are suitable for this task. I can offer innovative and creativ Lisää

$20 AUD 7 päivässä
(2 arvostelua)

Hi, sir. I checked your project carefully. I have many experience in php and mysql. If you give me all data for the project, I will start working immediately. I can complete your project successfully. I look forward to Lisää

$30 AUD 1 päivässä
(1 arvostelu)

Hi, I am a german freelancer with years of experience in web development. I am able to finish your task in 1hour. Please feel free to ask any questions.

$67 AUD 1 päivässä
(0 arvostelua)

i will do this work in one day. only add one condition. after this added this condition. it will work fine.

$20 AUD 1 päivässä
(0 arvostelua)

You're trying to convert an empty string to a date... You need to know which date you want to have shown in case there Is no active event. Also, the whole code is overkill and in a bad style... Relevant Skills and E Lisää

$28 AUD 1 päivässä
(0 arvostelua)