Tell us what’s happening:
I have consolidated the different services into one function that takes an argument.
SERVICE_SCREEN() {
echo -e "\nWhat's your phone number?"
read CUSTOMER_PHONE
CUSTOMER_NAME=$($PSQL "SELECT name FROM customers WHERE phone='$CUSTOMER_PHONE'")
if [[ -z $CUSTOMER_PHONE ]]
then
echo -e "\nI don't have a record for that phone number, what's your name?"
read CUSTOMER_NAME
fi
echo -e "\nWhat time would you like your $1, $CUSTOMER_NAME?"
read SERVICE_TIME;
}
However, when I run it, with the phone number 999-999-9999, this happens:
~~~~~ MY SALON ~~~~~
Welcome to My Salon, how can I help you?
1) cut
2) color
3) perm
4) style
5) trim
2
What's your phone number?
999-999-9999
What time would you like your color, name
------
(0 rows)?
I ran the command in the psql
shell, and it popped up with
name
------
(0 rows)
I also inserted 555-555-5555 as Fabio
, and it resulted in
What time would you like your color, name
-------
Fabio
(1 row)?
Can you help me?
(and yes, phone
is unique)
Your code so far
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36
Challenge Information:
Salon Appointment Scheduler - Build a Salon Appointment Scheduler